From e50ac08e7178533300ff6850b1c11102303cd35a Mon Sep 17 00:00:00 2001 From: Samuel Galson <samgalson@gmail.com> Date: Thu, 5 Oct 2017 14:59:34 +0100 Subject: [PATCH] access node_env through config.util --- README.md | 4 ++-- config/custom-environment-variables.js | 1 - src/setup-db/generate-env.js | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 config/custom-environment-variables.js diff --git a/README.md b/README.md index 44417596c..65b22d354 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ It can be called without arguments, in which case it will take its configuration ``` Alternatively it can be passed the `dbManager` object as an argument, which will override the values on config. -The name of the database will be the full dbPath with the NODE_ENV appended. +The name of the database will be the full `dbPath`. ### `addUser` @@ -61,5 +61,5 @@ addUser({ ### `dbExists` -This function checks if any database exists at the configured path for the current NODE_ENV. Returns `true` or `false` +This function checks if any database exists at the configured path. Returns `true` or `false` diff --git a/config/custom-environment-variables.js b/config/custom-environment-variables.js deleted file mode 100644 index 5da7ea703..000000000 --- a/config/custom-environment-variables.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = { NODE_ENV: 'NODE_ENV' } \ No newline at end of file diff --git a/src/setup-db/generate-env.js b/src/setup-db/generate-env.js index cc1d571d3..5f1572238 100644 --- a/src/setup-db/generate-env.js +++ b/src/setup-db/generate-env.js @@ -3,9 +3,10 @@ const fs = require('fs-extra') const crypto = require('crypto') const logger = require('@pubsweet/logger') const _ = require('lodash/fp') +const config = require('config') module.exports = () => { - const configFilePath = path.join(process.cwd(), 'config', `local-${process.env.NODE_ENV}.json`) + const configFilePath = path.join(process.cwd(), 'config', `local-${config.util.getEnv('NODE_ENV')}.json`) logger.info(`Adding pubsweet secret to ${configFilePath}`) let configObj -- GitLab