Skip to content

Commit

Permalink
Fix issue with loading config from a node_module
Browse files Browse the repository at this point in the history
  • Loading branch information
Dom Harrington committed May 10, 2018
1 parent 0bc12e1 commit 633b64b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
const path = require('path');
// We have to do this otherwise `require('config')` loads
// from the cwd where the user is running `rdme` which
// wont be what we want
//
// This is a little sketchy overwriting environment variables
// but since this is only supposed to be a cli and not
// requireable, i think this is okay
const configDir = process.env.NODE_CONFIG_DIR;
process.env.NODE_CONFIG_DIR = path.join(__dirname, '/config');

const config = require('config');

process.env.NODE_CONFIG_DIR = configDir;

const { version } = require('./package.json');

function load(command = 'help') {
Expand Down

0 comments on commit 633b64b

Please sign in to comment.