File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,6 @@ export default {
99 help : "Your Parse Master Key" ,
1010 required : true
1111 } ,
12- "serverURL" : {
13- env : "PARSE_SERVER_URL" ,
14- help : "URL to your parse server with http:// or https://." ,
15- required : true
16- } ,
1712 "port" : {
1813 port : "PORT" ,
1914 help : "The port to run the ParseServer. defaults to 1337." ,
@@ -30,6 +25,10 @@ export default {
3025 env : "PARSE_SERVER_DATABASE_URI" ,
3126 help : "The full URI to your mongodb database"
3227 } ,
28+ "serverURL" : {
29+ env : "PARSE_SERVER_URL" ,
30+ help : "URL to your parse server with http:// or https://." ,
31+ } ,
3332 "clientKey" : {
3433 env : "PARSE_SERVER_CLIENT_KEY" ,
3534 help : "Key for iOS, MacOS, tvOS clients"
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ program.on('--help', function(){
3434
3535program . parse ( process . argv , process . env ) ;
3636
37+ let options ;
3738if ( program . args . length > 0 ) {
3839 let jsonPath = program . args [ 0 ] ;
3940 jsonPath = path . resolve ( jsonPath ) ;
@@ -49,12 +50,16 @@ if (!program.appId || !program.masterKey || !program.serverURL) {
4950 process . exit ( 1 ) ;
5051}
5152
52- let options = Object . keys ( definitions ) . reduce ( function ( options , key ) {
53+ options = Object . keys ( definitions ) . reduce ( function ( options , key ) {
5354 if ( program [ key ] ) {
5455 options [ key ] = program [ key ] ;
5556 }
5657 return options ;
57- } , { } ) ;
58+ } , options ) ;
59+
60+ if ( ! options . serverURL ) {
61+ options . serverURL = `http://localhost:${ options . port } ${ options . mountPath } ` ;
62+ }
5863
5964const app = express ( ) ;
6065const api = new ParseServer ( options ) ;
@@ -70,5 +75,5 @@ app.listen(options.port, function() {
7075 console . log ( `${ key } : ${ value } ` ) ;
7176 }
7277 console . log ( '' ) ;
73- console . log ( 'parse-server running on http://localhost:' + options . port + options . mountPath ) ;
78+ console . log ( 'parse-server running on ' + options . serverURL ) ;
7479} ) ;
You can’t perform that action at this time.
0 commit comments