Skip to content

Commit

Permalink
fix(core): make app.js optional as initially intended (#3510)
Browse files Browse the repository at this point in the history
  • Loading branch information
faustbrian authored Feb 19, 2020
1 parent bf16abd commit 9f5785e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/core/bin/config/testnet/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ module.exports = {
},
},
},
}
};
18 changes: 14 additions & 4 deletions packages/core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,26 @@ export const updateEnvironmentVariables = (envFile: string, variables: Environme
};

export const getCliConfig = (
options: Record<string, any>,
flags: Record<string, any>,
paths: envPaths.Paths,
defaultValue = {},
): Record<string, any> => {
const configPath: string = `${paths.config}/app.js`;
if (!existsSync(configPath)) {
const configPaths: string[] = [`${paths.config}/app.js`, resolve(__dirname, `../bin/config/${flags.network}/app.js`)];

let configPath: string;
for (const path of configPaths) {
if (existsSync(path)) {
configPath = path;

break;
}
}

if (!configPath) {
return defaultValue;
}

const key: string = `cli.${options.suffix}.run.plugins`;
const key: string = `cli.${flags.suffix}.run.plugins`;
const configuration = require(resolve(configPath));
if (!dottie.exists(configuration, key)) {
return defaultValue;
Expand Down

0 comments on commit 9f5785e

Please sign in to comment.