From b8e0aa1d456e5e73cb1701606e8a6df84894776a Mon Sep 17 00:00:00 2001 From: OhjeezwhathaveIdone <33481733+OhjeezwhathaveIdone@users.noreply.github.com> Date: Sat, 16 Jan 2021 00:15:32 +0000 Subject: [PATCH] Add object support in config --- src/helpers/config-helper.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/helpers/config-helper.js b/src/helpers/config-helper.js index 17b9ac6ea..ef7cdc3a9 100644 --- a/src/helpers/config-helper.js +++ b/src/helpers/config-helper.js @@ -20,10 +20,14 @@ const api = { if (args.url) { config = api.parseDbUrl(args.url); } else { - try { - config = require(api.getConfigFile()); - } catch (e) { - api.error = e; + if (typeof args.config === 'object') { + config = args.config; + } else { + try { + config = require(api.getConfigFile()); + } catch (e) { + api.error = e; + } } } return config; @@ -46,7 +50,7 @@ const api = { }); }, getConfigFile() { - if (args.config) { + if (args.config && typeof args.config !== 'object') { return path.resolve(process.cwd(), args.config); }