From 729840642650359a865299011a60ce1a59d07a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Federico=20Marti=CC=81n=20Alconada=20Verzini?= Date: Wed, 22 Jul 2020 13:52:08 -0300 Subject: [PATCH] add more flexbility to config file --- src/config.js | 4 ++-- test/index_test.js | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/config.js b/src/config.js index 33cca20..d56fc2a 100644 --- a/src/config.js +++ b/src/config.js @@ -19,8 +19,8 @@ var Config = function() { config_file = ''; // load config from defaults or config file - if (typeof process != 'undefined' && process.env.STREAM_NODE_CONFIG_DIR) { - config_file = process.env.STREAM_NODE_CONFIG_DIR + '/getstream.js'; + if (typeof process != 'undefined' && process.env.STREAM_NODE_CONFIG_PATH) { + config_file = process.cwd() + process.env.STREAM_NODE_CONFIG_PATH; } else { config_file = process.cwd() + '/getstream.js'; } diff --git a/test/index_test.js b/test/index_test.js index 8c2c79d..efc583a 100644 --- a/test/index_test.js +++ b/test/index_test.js @@ -59,12 +59,11 @@ describe('Config', function() { }); describe.skip('Config Env Var', function() { - var configDir = path.join(__dirname, './tmp'); - var configFile = path.join(configDir, 'getstream.js'); + var configFile = '/tmp/getstream.js'; before(function() { this.env = pmock.env({ - STREAM_NODE_CONFIG_DIR: configDir, + STREAM_NODE_CONFIG_PATH: configFile, }); mockery.enable({