@@ -9,7 +9,7 @@ program.loadDefinitions(definitions);
9
9
10
10
program
11
11
. usage ( '[options] <path/to/configuration.json>' ) ;
12
-
12
+
13
13
program . on ( '--help' , function ( ) {
14
14
console . log ( ' Get Started guide:' ) ;
15
15
console . log ( '' ) ;
@@ -31,19 +31,27 @@ program.on('--help', function(){
31
31
console . log ( ' $ parse-server -- --appId APP_ID --masterKey MASTER_KEY --serverURL serverURL' ) ;
32
32
console . log ( '' ) ;
33
33
} ) ;
34
-
34
+
35
35
program . parse ( process . argv , process . env ) ;
36
36
37
37
let options = { } ;
38
38
if ( program . args . length > 0 ) {
39
39
let jsonPath = program . args [ 0 ] ;
40
40
jsonPath = path . resolve ( jsonPath ) ;
41
- options = require ( jsonPath ) ;
41
+ let jsonConfig = require ( jsonPath ) ;
42
+ if ( jsonConfig . apps ) {
43
+ if ( jsonConfig . apps . length > 1 ) {
44
+ throw 'Multiple apps are not supported' ;
45
+ }
46
+ options = jsonConfig . apps [ 0 ] ;
47
+ } else {
48
+ options = jsonConfig ;
49
+ }
42
50
console . log ( `Configuation loaded from ${ jsonPath } ` )
43
- }
51
+ }
44
52
45
53
options = Object . keys ( definitions ) . reduce ( function ( options , key ) {
46
- if ( program [ key ] ) {
54
+ if ( typeof program [ key ] !== 'undefined' ) {
47
55
options [ key ] = program [ key ] ;
48
56
}
49
57
return options ;
@@ -66,7 +74,7 @@ const api = new ParseServer(options);
66
74
app . use ( options . mountPath , api ) ;
67
75
68
76
var server = app . listen ( options . port , function ( ) {
69
-
77
+
70
78
for ( let key in options ) {
71
79
let value = options [ key ] ;
72
80
if ( key == "masterKey" ) {
0 commit comments