@@ -20,16 +20,14 @@ var configDefaults = JSON.parse(fs.readFileSync(path.join(__dirname, '../config/
20
20
config = _ . defaults ( JSON . parse ( fs . readFileSync ( args [ 0 ] ) ) , configDefaults ) ,
21
21
port = parseInt ( args [ 1 ] , 10 ) || config . port ,
22
22
workers = parseInt ( args [ 2 ] , 10 ) || config . workers ,
23
+ protocolMatch = ( config . baseURL || '' ) . match ( / ^ ( \w + ) : / ) ,
24
+ protocol = config . protocol = protocolMatch ? protocolMatch [ 1 ] : 'http' ,
23
25
constructors = { } ;
24
26
25
- // Setup protocol
26
- var protocolBaseUrl = config . baseURL . match ( / ^ ( .* ?) : \/ \/ .* / ) ;
27
- config . protocol = protocolBaseUrl ? protocolBaseUrl [ 1 ] : config . protocol ;
28
-
29
27
// Start up a cluster master
30
28
if ( cluster . isMaster ) {
31
29
// Create workers
32
- console . log ( 'Master %d running on %s://localhost:%d/.' , process . pid , config . protocol , port ) ;
30
+ console . log ( 'Master %d running on %s://localhost:%d/.' , process . pid , protocol , port ) ;
33
31
for ( var i = 0 ; i < workers ; i ++ )
34
32
cluster . fork ( ) ;
35
33
@@ -174,7 +172,7 @@ else {
174
172
function startWhenReady ( ) {
175
173
if ( ! -- pending ) {
176
174
server . listen ( port ) ;
177
- console . log ( 'Worker %d running on %s://localhost:%d/.' , process . pid , config . protocol , port ) ;
175
+ console . log ( 'Worker %d running on %s://localhost:%d/.' , process . pid , protocol , port ) ;
178
176
}
179
177
}
180
178
0 commit comments