File tree Expand file tree Collapse file tree 7 files changed +24
-12
lines changed Expand file tree Collapse file tree 7 files changed +24
-12
lines changed Original file line number Diff line number Diff line change @@ -103,14 +103,14 @@ class GethCommands {
103103 if ( config . wsOrigins ) {
104104 if ( config . wsOrigins === '*' ) {
105105 console . log ( '==================================' ) ;
106- console . log ( 'rpcCorsDomain set to *' ) ;
106+ console . log ( 'wsOrigins set to *' ) ;
107107 console . log ( 'make sure you know what you are doing' ) ;
108108 console . log ( '==================================' ) ;
109109 }
110110 cmd += "--wsorigins \"" + config . wsOrigins + "\" " ;
111111 } else {
112112 console . log ( '==================================' ) ;
113- console . log ( 'warning: cors is not set' ) ;
113+ console . log ( 'warning: wsOrigins is not set' ) ;
114114 console . log ( '==================================' ) ;
115115 }
116116 }
Original file line number Diff line number Diff line change @@ -39,7 +39,19 @@ class Embark {
3939
4040 blockchain ( env , client ) {
4141 this . context = [ constants . contexts . blockchain ] ;
42- return require ( './cmds/blockchain/blockchain.js' ) ( this . config . blockchainConfig , client , env ) . run ( ) ;
42+ let blockchainConfig = this . config . blockchainConfig ;
43+ let storageConfig = this . config . storageConfig ;
44+ let webServerConfig = this . config . webServerConfig ;
45+
46+ if ( blockchainConfig . rpcCorsDomain === 'auto' ) {
47+ if ( webServerConfig ) blockchainConfig . rpcCorsDomain = `http://${ webServerConfig . host } :${ webServerConfig . port } ` ;
48+ if ( storageConfig ) blockchainConfig . rpcCorsDomain += `${ blockchainConfig . rpcCorsDomain . length ? ',' : '' } http://${ storageConfig . host } :${ storageConfig . port } ` ;
49+ }
50+ if ( blockchainConfig . wsOrigins === 'auto' ) {
51+ if ( webServerConfig ) blockchainConfig . wsOrigins = `http://${ webServerConfig . host } :${ webServerConfig . port } ` ;
52+ if ( storageConfig ) blockchainConfig . wsOrigins += `${ blockchainConfig . wsOrigins . length ? ',' : '' } http://${ storageConfig . host } :${ storageConfig . port } ` ;
53+ }
54+ return require ( './cmds/blockchain/blockchain.js' ) ( blockchainConfig , client , env ) . run ( ) ;
4355 }
4456
4557 simulator ( options ) {
Original file line number Diff line number Diff line change 99 "maxpeers" : 0 ,
1010 "rpcHost" : " localhost" ,
1111 "rpcPort" : 8545 ,
12- "rpcCorsDomain" : " http://localhost:8000 " ,
12+ "rpcCorsDomain" : " auto " ,
1313 "account" : {
1414 "password" : " config/development/password"
1515 },
1616 "targetGasLimit" : 8000000 ,
17- "wsOrigins" : " http://localhost:8000 " ,
17+ "wsOrigins" : " auto " ,
1818 "wsRPC" : true ,
1919 "wsHost" : " localhost" ,
2020 "wsPort" : 8546 ,
Original file line number Diff line number Diff line change 99 "maxpeers" : 0 ,
1010 "rpcHost" : " localhost" ,
1111 "rpcPort" : 8545 ,
12- "rpcCorsDomain" : " http://localhost:8000 " ,
12+ "rpcCorsDomain" : " auto " ,
1313 "account" : {
1414 "password" : " config/development/password"
1515 },
1616 "targetGasLimit" : 8000000 ,
17- "wsOrigins" : " http://localhost:8000 " ,
17+ "wsOrigins" : " auto " ,
1818 "wsRPC" : true ,
1919 "wsHost" : " localhost" ,
2020 "wsPort" : 8546 ,
Original file line number Diff line number Diff line change 77 "nodiscover" : true ,
88 "rpcHost" : " localhost" ,
99 "rpcPort" : 8545 ,
10- "rpcCorsDomain" : " http://localhost:8000 " ,
10+ "rpcCorsDomain" : " auto " ,
1111 "account" : {
1212 "password" : " config/development/password"
1313 }
Original file line number Diff line number Diff line change 99 "maxpeers" : 0 ,
1010 "rpcHost" : " localhost" ,
1111 "rpcPort" : 8545 ,
12- "rpcCorsDomain" : " http://localhost:8000 " ,
12+ "rpcCorsDomain" : " auto " ,
1313 "account" : {
1414 "password" : " development/password"
1515 },
1616 "targetGasLimit" : 8000000 ,
17- "wsOrigins" : " http://localhost:8000 " ,
17+ "wsOrigins" : " auto " ,
1818 "wsRPC" : true ,
1919 "wsHost" : " localhost" ,
2020 "wsPort" : 8546
Original file line number Diff line number Diff line change 99 "maxpeers" : 0 ,
1010 "rpcHost" : " localhost" ,
1111 "rpcPort" : 8545 ,
12- "rpcCorsDomain" : " http://localhost:8000 " ,
12+ "rpcCorsDomain" : " auto " ,
1313 "account" : {
1414 "password" : " config/development/password"
1515 },
1616 "targetGasLimit" : 8000000 ,
17- "wsOrigins" : " http://localhost:8000 " ,
17+ "wsOrigins" : " auto " ,
1818 "wsRPC" : true ,
1919 "wsHost" : " localhost" ,
2020 "wsPort" : 8546
You can’t perform that action at this time.
0 commit comments