From df81f4fc57c14a11cac8826fdd6a5d055757b918 Mon Sep 17 00:00:00 2001 From: Allison Kemmerle Date: Thu, 19 Dec 2024 16:54:21 -0500 Subject: [PATCH] Streamline loading config p2 --- bin/cli.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/bin/cli.js b/bin/cli.js index 568d5a7f2..da9a691e4 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -164,17 +164,13 @@ const loadConfigMiddleware = async options => { }; // Load the new config and check for the conflicting config flag - if (configFileExists(true)) { - loadConfig('', options); - - if (options.config) { - logger.error( - i18n(`${i18nKey}.loadConfigMiddleware.configFileExists`, { - configPath: getConfigPath(), - }) - ); - process.exit(EXIT_CODES.ERROR); - } + if (configFileExists(true) && options.config) { + logger.error( + i18n(`${i18nKey}.loadConfigMiddleware.configFileExists`, { + configPath: getConfigPath(), + }) + ); + process.exit(EXIT_CODES.ERROR); } else { // We need to load the config when options.config exists, // so that getAccountIdFromConfig() in injectAccountIdMiddleware reads from the right config