Merge pull request #1509 from chaotixkilla/fix-add-environment-migration-path-null-check

LAM-823 Add environment migration path null check
This commit is contained in:
Rafael Taranto 2023-02-09 10:52:48 +00:00 committed by GitHub
commit 743862c940

View file

@ -4,7 +4,7 @@ const path = require('path')
const _ = require('lodash/fp')
const setEnvVariable = (key, value, opts) => {
const ENV_PATH = !_.isNil(opts.ENV_PATH) ? opts.ENV_PATH : path.resolve(__dirname, '../.env')
const ENV_PATH = !_.isNil(opts?.ENV_PATH) ? opts.ENV_PATH : path.resolve(__dirname, '../.env')
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}=`))))