refactor: resolve configs immediately

This commit is contained in:
Rhys Arkins 2018-06-21 08:43:19 +02:00
parent 12519bbf8f
commit 2decb37a1d

View file

@ -36,17 +36,14 @@ async function parseConfigs(env, argv) {
logger.debug('Parsing configs'); logger.debug('Parsing configs');
// Get configs // Get configs
const defaultConfig = defaultsParser.getConfig(); const defaultConfig = await resolveConfigPresets(defaultsParser.getConfig());
const fileConfig = fileParser.getConfig(env); const fileConfig = await resolveConfigPresets(fileParser.getConfig(env));
const cliConfig = cliParser.getConfig(argv); const cliConfig = await resolveConfigPresets(cliParser.getConfig(argv));
const envConfig = envParser.getConfig(env); const envConfig = await resolveConfigPresets(envParser.getConfig(env));
let config = mergeChildConfig( let config = mergeChildConfig(defaultConfig, fileConfig);
await resolveConfigPresets(defaultConfig), config = mergeChildConfig(config, envConfig);
await resolveConfigPresets(fileConfig) config = mergeChildConfig(config, cliConfig);
);
config = mergeChildConfig(config, await resolveConfigPresets(envConfig));
config = mergeChildConfig(config, await resolveConfigPresets(cliConfig));
// Set log level // Set log level
logger.levels('stdout', config.logLevel); logger.levels('stdout', config.logLevel);