Adds missing options to the CLI
This commit is contained in:
@@ -1,3 +1,37 @@
|
||||
function numberParser(key) {
|
||||
return function(opt) {
|
||||
opt = parseInt(opt);
|
||||
if (!Number.isInteger(opt)) {
|
||||
throw new Error(`The ${key} is invalid`);
|
||||
}
|
||||
return opt;
|
||||
}
|
||||
}
|
||||
|
||||
function objectParser(opt) {
|
||||
if (typeof opt == 'object') {
|
||||
return opt;
|
||||
}
|
||||
return JSON.parse(opt)
|
||||
}
|
||||
|
||||
function moduleOrObjectParser(opt) {
|
||||
if (typeof opt == 'object') {
|
||||
return opt;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(opt);
|
||||
} catch(e) {}
|
||||
return opt;
|
||||
}
|
||||
|
||||
function booleanParser(opt) {
|
||||
if (opt == true || opt == "true" || opt == "1") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export default {
|
||||
"appId": {
|
||||
env: "PARSE_SERVER_APPLICATION_ID",
|
||||
@@ -13,18 +47,21 @@ export default {
|
||||
env: "PORT",
|
||||
help: "The port to run the ParseServer. defaults to 1337.",
|
||||
default: 1337,
|
||||
action: function(opt) {
|
||||
opt = parseInt(opt);
|
||||
if (!Number.isInteger(opt)) {
|
||||
throw new Error("The port is invalid");
|
||||
}
|
||||
return opt;
|
||||
}
|
||||
action: numberParser("port")
|
||||
},
|
||||
"databaseURI": {
|
||||
env: "PARSE_SERVER_DATABASE_URI",
|
||||
help: "The full URI to your mongodb database"
|
||||
},
|
||||
"databaseOptions": {
|
||||
env: "PARSE_SERVER_DATABASE_OPTIONS",
|
||||
help: "Options to pass to the mongodb client",
|
||||
action: objectParser
|
||||
},
|
||||
"collectionPrefix": {
|
||||
env: "PARSE_SERVER_COLLECTION_PREFIX",
|
||||
help: 'A collection prefix for the classes'
|
||||
},
|
||||
"serverURL": {
|
||||
env: "PARSE_SERVER_URL",
|
||||
help: "URL to your parse server with http:// or https://.",
|
||||
@@ -56,22 +93,12 @@ export default {
|
||||
"push": {
|
||||
env: "PARSE_SERVER_PUSH",
|
||||
help: "Configuration for push, as stringified JSON. See https://github.com/ParsePlatform/parse-server/wiki/Push",
|
||||
action: function(opt) {
|
||||
if (typeof opt == 'object') {
|
||||
return opt;
|
||||
}
|
||||
return JSON.parse(opt)
|
||||
}
|
||||
action: objectParser
|
||||
},
|
||||
"oauth": {
|
||||
env: "PARSE_SERVER_OAUTH_PROVIDERS",
|
||||
help: "Configuration for your oAuth providers, as stringified JSON. See https://github.com/ParsePlatform/parse-server/wiki/Parse-Server-Guide#oauth",
|
||||
action: function(opt) {
|
||||
if (typeof opt == 'object') {
|
||||
return opt;
|
||||
}
|
||||
return JSON.parse(opt)
|
||||
}
|
||||
action: objectParser
|
||||
},
|
||||
"fileKey": {
|
||||
env: "PARSE_SERVER_FILE_KEY",
|
||||
@@ -88,22 +115,12 @@ export default {
|
||||
"enableAnonymousUsers": {
|
||||
env: "PARSE_SERVER_ENABLE_ANON_USERS",
|
||||
help: "Enable (or disable) anon users, defaults to true",
|
||||
action: function(opt) {
|
||||
if (opt == "true" || opt == "1") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
action: booleanParser
|
||||
},
|
||||
"allowClientClassCreation": {
|
||||
env: "PARSE_SERVER_ALLOW_CLIENT_CLASS_CREATION",
|
||||
help: "Enable (or disable) client class creation, defaults to true",
|
||||
action: function(opt) {
|
||||
if (opt == "true" || opt == "1") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
action: booleanParser
|
||||
},
|
||||
"mountPath": {
|
||||
env: "PARSE_SERVER_MOUNT_PATH",
|
||||
@@ -113,65 +130,45 @@ export default {
|
||||
"filesAdapter": {
|
||||
env: "PARSE_SERVER_FILES_ADAPTER",
|
||||
help: "Adapter module for the files sub-system",
|
||||
action: function action(opt) {
|
||||
if (typeof opt == 'object') {
|
||||
return opt;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(opt);
|
||||
} catch(e) {}
|
||||
return opt;
|
||||
}
|
||||
action: moduleOrObjectParser
|
||||
},
|
||||
"emailAdapter": {
|
||||
env: "PARSE_SERVER_EMAIL_ADAPTER",
|
||||
help: "Adapter module for the email sending",
|
||||
action: function action(opt) {
|
||||
if (typeof opt == 'object') {
|
||||
return opt;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(opt);
|
||||
} catch(e) {}
|
||||
return opt;
|
||||
}
|
||||
action: moduleOrObjectParser
|
||||
},
|
||||
"verifyUserEmails": {
|
||||
env: "PARSE_SERVER_VERIFY_USER_EMAILS",
|
||||
help: "Enable (or disable) user email validation, defaults to false",
|
||||
action: booleanParser
|
||||
},
|
||||
"appName": {
|
||||
env: "PARSE_SERVER_APP_NAME",
|
||||
help: "Sets the app name"
|
||||
},
|
||||
"loggerAdapter": {
|
||||
env: "PARSE_SERVER_LOGGER_ADAPTER",
|
||||
help: "Adapter module for the logging sub-system",
|
||||
action: function action(opt) {
|
||||
if (typeof opt == 'object') {
|
||||
return opt;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(opt);
|
||||
} catch(e) {}
|
||||
return opt;
|
||||
}
|
||||
action: moduleOrObjectParser
|
||||
},
|
||||
"liveQuery": {
|
||||
env: "PARSE_SERVER_LIVE_QUERY_OPTIONS",
|
||||
help: "liveQuery options",
|
||||
action: function action(opt) {
|
||||
if (typeof opt == 'object') {
|
||||
return opt;
|
||||
}
|
||||
return JSON.parse(opt);
|
||||
}
|
||||
action: objectParser
|
||||
},
|
||||
"customPages": {
|
||||
env: "PARSE_SERVER_CUSTOM_PAGES",
|
||||
help: "custom pages for pasword validation and reset",
|
||||
action: function action(opt) {
|
||||
if (typeof opt == 'object') {
|
||||
return opt;
|
||||
}
|
||||
return JSON.parse(opt);
|
||||
}
|
||||
action: objectParser
|
||||
},
|
||||
"maxUploadSize": {
|
||||
env: "PARSE_SERVER_MAX_UPLOAD_SIZE",
|
||||
help: "Max file size for uploads.",
|
||||
default: "20mb"
|
||||
},
|
||||
"sessionLength": {
|
||||
env: "PARSE_SERVER_SESSION_LENGTH",
|
||||
help: "Session duration, defaults to 1 year",
|
||||
action: numberParser("sessionLength")
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user