fix: regression caused by 94b79ce402

`./nodebb setup` was no longer able to be called without arguments or env vars
isekai-main
Julian Lam 3 years ago
parent 3acd2ac850
commit 4164898d85

@ -47,7 +47,7 @@ questions.optional = [
]; ];
function checkSetupFlagEnv() { function checkSetupFlagEnv() {
let setupVal = install.values || {}; let setupVal = install.values;
const envConfMap = { const envConfMap = {
NODEBB_URL: 'url', NODEBB_URL: 'url',
@ -65,7 +65,10 @@ function checkSetupFlagEnv() {
}; };
// Set setup values from env vars (if set) // Set setup values from env vars (if set)
const envKeys = Object.keys(process.env);
if (Object.keys(envConfMap).some(key => envKeys.includes(key))) {
winston.info('[install/checkSetupFlagEnv] checking env vars for setup info...'); winston.info('[install/checkSetupFlagEnv] checking env vars for setup info...');
setupVal = setupVal || {};
Object.entries(process.env).forEach(([evName, evValue]) => { // get setup values from env Object.entries(process.env).forEach(([evName, evValue]) => { // get setup values from env
if (evName.startsWith('NODEBB_DB_')) { if (evName.startsWith('NODEBB_DB_')) {
@ -76,6 +79,7 @@ function checkSetupFlagEnv() {
}); });
setupVal['admin:password:confirm'] = setupVal['admin:password']; setupVal['admin:password:confirm'] = setupVal['admin:password'];
}
// try to get setup values from json, if successful this overwrites all values set by env // try to get setup values from json, if successful this overwrites all values set by env
// TODO: better behaviour would be to support overrides per value, i.e. in order of priority (generic pattern): // TODO: better behaviour would be to support overrides per value, i.e. in order of priority (generic pattern):

Loading…
Cancel
Save