change to use an object instead and change templates

This commit is contained in:
Jonathan Rainville 2019-01-09 09:21:16 -05:00
parent 9e349ff267
commit 1bafc41d97
4 changed files with 32 additions and 16 deletions

View File

@ -165,13 +165,17 @@ Config.prototype._updateBlockchainCors = function(){
let cors = corsParts.join(',');
if (blockchainConfig.rpcCorsDomain === 'auto') {
blockchainConfig.rpcCorsDomain = cors;
} else if (blockchainConfig.rpcCorsDomain.indexOf('auto') > -1) {
blockchainConfig.rpcCorsDomain = blockchainConfig.rpcCorsDomain.replace('auto', cors);
} else if (typeof blockchainConfig.rpcCorsDomain === 'object') {
let tempCors = blockchainConfig.rpcCorsDomain.auto ? corsParts : [];
tempCors = tempCors.concat(blockchainConfig.rpcCorsDomain.additionalCors || []);
blockchainConfig.rpcCorsDomain = tempCors.join(',');
}
if (blockchainConfig.wsOrigins === 'auto') {
blockchainConfig.wsOrigins = cors;
} else if (blockchainConfig.wsOrigins.indexOf('auto') > -1) {
blockchainConfig.wsOrigins = blockchainConfig.wsOrigins.replace('auto', cors);
} else if (typeof blockchainConfig.wsOrigins === 'object') {
let tempCors = blockchainConfig.wsOrigins.auto ? corsParts : [];
tempCors = tempCors.concat(blockchainConfig.wsOrigins.additionalCors || []);
blockchainConfig.wsOrigins = tempCors.join(',');
}
};

View File

@ -4,11 +4,15 @@ module.exports = {
enabled: true,
rpcHost: "localhost", // HTTP-RPC server listening interface (default: "localhost")
rpcPort: 8545, // HTTP-RPC server listening port (default: 8545)
rpcCorsDomain: "auto", // Comma separated list of domains from which to accept cross origin requests (browser enforced)
// When set to "auto", Embark will automatically set the cors to the address of the webserver
rpcCorsDomain: { // Domains from which to accept cross origin requests (browser enforced). This can also be a comma separated list
auto: true, // When "auto" is true, Embark will automatically set the cors to the address of the webserver
additionalCors: [] // Additional CORS domains to add to the list. If "auto" is false, only those will be added
},
wsRPC: true, // Enable the WS-RPC server
wsOrigins: "auto", // Origins from which to accept websockets requests
// When set to "auto", Embark will automatically set the cors to the address of the webserver
wsOrigins: { // Same thing as "rpcCorsDomain", but for WS origins
auto: true,
additionalCors: []
},
wsHost: "localhost", // WS-RPC server listening interface (default: "localhost")
wsPort: 8546 // WS-RPC server listening port (default: 8546)

View File

@ -4,11 +4,15 @@ module.exports = {
enabled: true,
rpcHost: "localhost", // HTTP-RPC server listening interface (default: "localhost")
rpcPort: 8545, // HTTP-RPC server listening port (default: 8545)
rpcCorsDomain: "auto", // Comma separated list of domains from which to accept cross origin requests (browser enforced)
// When set to "auto", Embark will automatically set the cors to the address of the webserver
rpcCorsDomain: { // Domains from which to accept cross origin requests (browser enforced). This can also be a comma separated list
auto: true, // When "auto" is true, Embark will automatically set the cors to the address of the webserver
additionalCors: [] // Additional CORS domains to add to the list. If "auto" is false, only those will be added
},
wsRPC: true, // Enable the WS-RPC server
wsOrigins: "auto", // Origins from which to accept websockets requests
// When set to "auto", Embark will automatically set the cors to the address of the webserver
wsOrigins: { // Same thing as "rpcCorsDomain", but for WS origins
auto: true,
additionalCors: []
},
wsHost: "localhost", // WS-RPC server listening interface (default: "localhost")
wsPort: 8546 // WS-RPC server listening port (default: 8546)

View File

@ -4,11 +4,15 @@ module.exports = {
enabled: true,
rpcHost: "localhost", // HTTP-RPC server listening interface (default: "localhost")
rpcPort: 8545, // HTTP-RPC server listening port (default: 8545)
rpcCorsDomain: "auto", // Comma separated list of domains from which to accept cross origin requests (browser enforced)
// When set to "auto", Embark will automatically set the cors to the address of the webserver
rpcCorsDomain: { // Domains from which to accept cross origin requests (browser enforced). This can also be a comma separated list
auto: true, // When "auto" is true, Embark will automatically set the cors to the address of the webserver
additionalCors: [] // Additional CORS domains to add to the list. If "auto" is false, only those will be added
},
wsRPC: true, // Enable the WS-RPC server
wsOrigins: "auto", // Origins from which to accept websockets requests
// When set to "auto", Embark will automatically set the cors to the address of the webserver
wsOrigins: { // Same thing as "rpcCorsDomain", but for WS origins
auto: true,
additionalCors: []
},
wsHost: "localhost", // WS-RPC server listening interface (default: "localhost")
wsPort: 8546 // WS-RPC server listening port (default: 8546)
},