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