Skip to content

Commit 09279d1

Browse files
committed
Allows loading cli adapters from module path
1 parent dbf64a6 commit 09279d1

File tree

1 file changed

+58
-25
lines changed

1 file changed

+58
-25
lines changed

src/cli/cli-definitions.js

Lines changed: 58 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
export default {
2-
"appId": {
2+
"appId": {
33
env: "PARSE_SERVER_APPLICATION_ID",
44
help: "Your Parse Application ID",
55
required: true
66
},
7-
"masterKey": {
7+
"masterKey": {
88
env: "PARSE_SERVER_MASTER_KEY",
99
help: "Your Parse Master Key",
1010
required: true
@@ -21,53 +21,59 @@ export default {
2121
return opt;
2222
}
2323
},
24-
"databaseURI": {
24+
"databaseURI": {
2525
env: "PARSE_SERVER_DATABASE_URI",
2626
help: "The full URI to your mongodb database"
2727
},
28-
"serverURL": {
28+
"serverURL": {
2929
env: "PARSE_SERVER_URL",
3030
help: "URL to your parse server with http:// or https://.",
3131
},
32-
"clientKey": {
32+
"clientKey": {
3333
env: "PARSE_SERVER_CLIENT_KEY",
3434
help: "Key for iOS, MacOS, tvOS clients"
3535
},
36-
"javascriptKey": {
36+
"javascriptKey": {
3737
env: "PARSE_SERVER_JAVASCRIPT_KEY",
3838
help: "Key for the Javascript SDK"
39-
},
40-
"restAPIKey": {
39+
},
40+
"restAPIKey": {
4141
env: "PARSE_SERVER_REST_API_KEY",
4242
help: "Key for REST calls"
43-
},
44-
"dotNetKey": {
43+
},
44+
"dotNetKey": {
4545
env: "PARSE_SERVER_DOT_NET_KEY",
4646
help: "Key for Unity and .Net SDK"
47-
},
48-
"cloud": {
47+
},
48+
"cloud": {
4949
env: "PARSE_SERVER_CLOUD_CODE_MAIN",
5050
help: "Full path to your cloud code main.js"
51-
},
51+
},
5252
"push": {
5353
env: "PARSE_SERVER_PUSH",
5454
help: "Configuration for push, as stringified JSON. See https://github.com/ParsePlatform/parse-server/wiki/Push",
5555
action: function(opt) {
56+
if (typeof opt == 'object') {
57+
return opt;
58+
}
5659
return JSON.parse(opt)
5760
}
5861
},
59-
"oauth": {
62+
"oauth": {
6063
env: "PARSE_SERVER_OAUTH_PROVIDERS",
6164
help: "Configuration for your oAuth providers, as stringified JSON. See https://github.com/ParsePlatform/parse-server/wiki/Parse-Server-Guide#oauth",
6265
action: function(opt) {
66+
if (typeof opt == 'object') {
67+
return opt;
68+
}
6369
return JSON.parse(opt)
6470
}
6571
},
66-
"fileKey": {
72+
"fileKey": {
6773
env: "PARSE_SERVER_FILE_KEY",
6874
help: "Key for your files",
69-
},
70-
"facebookAppIds": {
75+
},
76+
"facebookAppIds": {
7177
env: "PARSE_SERVER_FACEBOOK_APP_IDS",
7278
help: "Comma separated list for your facebook app Ids",
7379
type: "list",
@@ -81,7 +87,7 @@ export default {
8187
action: function(opt) {
8288
if (opt == "true" || opt == "1") {
8389
return true;
84-
}
90+
}
8591
return false;
8692
}
8793
},
@@ -95,22 +101,49 @@ export default {
95101
return false;
96102
}
97103
},
98-
"mountPath": {
104+
"mountPath": {
99105
env: "PARSE_SERVER_MOUNT_PATH",
100106
help: "Mount path for the server, defaults to /parse",
101107
default: "/parse"
102108
},
103-
"databaseAdapter": {
104-
env: "PARSE_SERVER_DATABASE_ADAPTER",
105-
help: "Adapter module for the database sub-system"
106-
},
107109
"filesAdapter": {
108110
env: "PARSE_SERVER_FILES_ADAPTER",
109-
help: "Adapter module for the files sub-system"
111+
help: "Adapter module for the files sub-system",
112+
action: function action(opt) {
113+
if (typeof opt == 'object') {
114+
return opt;
115+
}
116+
try {
117+
return JSON.parse(opt);
118+
} catch(e) {}
119+
return opt;
120+
}
121+
},
122+
"emailAdapter": {
123+
env: "PARSE_SERVER_EMAIL_ADAPTER",
124+
help: "Adapter module for the email sending",
125+
action: function action(opt) {
126+
if (typeof opt == 'object') {
127+
return opt;
128+
}
129+
try {
130+
return JSON.parse(opt);
131+
} catch(e) {}
132+
return opt;
133+
}
110134
},
111135
"loggerAdapter": {
112136
env: "PARSE_SERVER_LOGGER_ADAPTER",
113-
help: "Adapter module for the logging sub-system"
137+
help: "Adapter module for the logging sub-system",
138+
action: function action(opt) {
139+
if (typeof opt == 'object') {
140+
return opt;
141+
}
142+
try {
143+
return JSON.parse(opt);
144+
} catch(e) {}
145+
return opt;
146+
}
114147
},
115148
"maxUploadSize": {
116149
env: "PARSE_SERVER_MAX_UPLOAD_SIZE",

0 commit comments

Comments
 (0)