fix: remove environment specific .env reading
This commit is contained in:
parent
df5bc81700
commit
8ad3b3eaad
3 changed files with 3 additions and 4 deletions
|
|
@ -1,2 +1 @@
|
||||||
const path = require('path')
|
require('dotenv').config()
|
||||||
require('dotenv').config({ path: process.env.NODE_ENV === 'production' ? path.resolve('/etc', 'lamassu', '.env') : path.resolve(__dirname, '../.env') })
|
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ function updateOptionBasepath (result, optionName) {
|
||||||
async function run () {
|
async function run () {
|
||||||
// load current opts
|
// load current opts
|
||||||
const options = load().opts
|
const options = load().opts
|
||||||
const shouldMigrate = !fs.existsSync(process.env.NODE_ENV === 'production' ? path.resolve('/etc', 'lamassu', '.env') : path.resolve(__dirname, '../.env'))
|
const shouldMigrate = !fs.existsSync(path.resolve(__dirname, '../.env'))
|
||||||
|
|
||||||
// write the resulting .env
|
// write the resulting .env
|
||||||
if (shouldMigrate) {
|
if (shouldMigrate) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ const os = require('os')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const setEnvVariable = (key, value) => {
|
const setEnvVariable = (key, value) => {
|
||||||
const ENV_PATH = process.env.NODE_ENV === 'production' ? path.resolve('/etc', 'lamassu', '.env') : path.resolve(__dirname, '../.env')
|
const ENV_PATH = path.resolve(__dirname, '../.env')
|
||||||
const ENV_VARIABLES = fs.readFileSync(ENV_PATH, 'utf-8').split(os.EOL)
|
const ENV_VARIABLES = fs.readFileSync(ENV_PATH, 'utf-8').split(os.EOL)
|
||||||
const target = ENV_VARIABLES.indexOf(ENV_VARIABLES.find(line => line.match(new RegExp(`^${key}=`))))
|
const target = ENV_VARIABLES.indexOf(ENV_VARIABLES.find(line => line.match(new RegExp(`^${key}=`))))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue