diff --git a/servers/cu/src/config.js b/servers/cu/src/config.js index 6983f5198..ac4dba324 100644 --- a/servers/cu/src/config.js +++ b/servers/cu/src/config.js @@ -44,17 +44,18 @@ const serverConfigSchema = domainConfigSchema.extend({ /* eslint-disable no-throw-literal */ /** - * If the WALLET_FILE env var is defined, load the contents from the file. - * Refuse to boot the app if both or none of WALLET and WALLET_FILE are defined. + * If the WALLET is defined, then do nothing. + * + * Otherwise, check whether the WALLET_FILE env var is defined and load it contents + * as WALLET */ export const preprocessWallet = (envConfig) => { const { WALLET, WALLET_FILE, ...theRestOfTheConfig } = envConfig - // nothing to do here - if (!!WALLET && !WALLET_FILE) return envConfig + // WALLET takes precendent. nothing to do here + if (WALLET) return envConfig if (!WALLET && !WALLET_FILE) throw 'One of WALLET or WALLET_FILE is required' - if (!!WALLET && !!WALLET_FILE) throw 'Do not define both WALLET and WALLET_FILE' const walletPath = path.resolve(WALLET_FILE) if (!existsSync(walletPath)) throw `WALLET_FILE does not exist: ${walletPath}`