@@ -75,6 +75,7 @@ class GethCommands {
7575 if ( config . rpcCorsDomain ) {
7676 if ( config . rpcCorsDomain === '*' ) {
7777 console . log ( '==================================' ) ;
78+ console . log ( 'rpcCorsDomain set to *' ) ;
7879 console . log ( 'make sure you know what you are doing' ) ;
7980 console . log ( '==================================' ) ;
8081 }
@@ -88,10 +89,34 @@ class GethCommands {
8889 return cmd ;
8990 }
9091
92+ determineWsOptions ( config ) {
93+ let cmd = "" ;
94+
95+ cmd += "--ws " ;
96+ cmd += "--wsport " + config . wsPort + " " ;
97+ cmd += "--wsaddr " + config . wsHost + " " ;
98+ if ( config . wsOrigins ) {
99+ if ( config . wsOrigins === '*' ) {
100+ console . log ( '==================================' ) ;
101+ console . log ( 'rpcCorsDomain set to *' ) ;
102+ console . log ( 'make sure you know what you are doing' ) ;
103+ console . log ( '==================================' ) ;
104+ }
105+ cmd += "--wsorigins \"" + config . wsOrigins + "\" " ;
106+ } else {
107+ console . log ( '==================================' ) ;
108+ console . log ( 'warning: cors is not set' ) ;
109+ console . log ( '==================================' ) ;
110+ }
111+
112+ return cmd ;
113+ }
114+
91115 mainCommand ( address , done ) {
92116 let self = this ;
93117 let config = this . config ;
94118 let rpc_api = ( this . config . rpcApi || [ 'eth' , 'web3' , 'net' ] ) ;
119+ let ws_api = ( this . config . wsApi || [ 'eth' , 'web3' , 'net' ] ) ;
95120
96121 async . series ( [
97122 function commonOptions ( callback ) {
@@ -102,6 +127,10 @@ class GethCommands {
102127 let cmd = self . determineRpcOptions ( self . config ) ;
103128 callback ( null , cmd ) ;
104129 } ,
130+ function wsOptions ( callback ) {
131+ let cmd = self . determineWsOptions ( self . config ) ;
132+ callback ( null , cmd ) ;
133+ } ,
105134 function dontGetPeers ( callback ) {
106135 if ( config . nodiscover ) {
107136 return callback ( null , "--nodiscover" ) ;
@@ -133,13 +162,17 @@ class GethCommands {
133162 function whisper ( callback ) {
134163 if ( config . whisper ) {
135164 rpc_api . push ( 'shh' ) ;
165+ ws_api . push ( 'shh' ) ;
136166 return callback ( null , "--shh " ) ;
137167 }
138168 callback ( "" ) ;
139169 } ,
140170 function rpcApi ( callback ) {
141171 callback ( null , '--rpcapi "' + rpc_api . join ( ',' ) + '"' ) ;
142172 } ,
173+ function wsApi ( callback ) {
174+ callback ( null , '--wsapi "' + ws_api . join ( ',' ) + '"' ) ;
175+ } ,
143176 function accountToUnlock ( callback ) {
144177 let accountAddress = "" ;
145178 if ( config . hasOwnProperty ( 'address' ) && config . account . hasOwnProperty ( 'address' ) ) {
0 commit comments