13 lines
368 B
JavaScript
13 lines
368 B
JavaScript
|
|
const DotEnv = require('dotenv')
|
|
|
|
module.exports = function () {
|
|
let script = process.env.npm_lifecycle_script;
|
|
script = script.substring(script.indexOf("NODE_ENV=") + "NODE_ENV=".length);
|
|
let name = script.substring(0,script.indexOf("&"))
|
|
console.log(name);
|
|
name = ".env." + name
|
|
let parsedEnv = DotEnv.config({ path: name }).parsed
|
|
return parsedEnv
|
|
}
|