diff --git a/EnvParse.js b/EnvParse.js index 00bb9b0..2925aa1 100644 --- a/EnvParse.js +++ b/EnvParse.js @@ -1,11 +1,12 @@ const DotEnv = require('dotenv') -const parsedEnv = DotEnv.config({ path: `.env.${process.env.NODE_ENV1123}` }).parsed module.exports = function () { - console.log(process.env.NODE_ENV1123) - console.log(process.env.NODE_ENV) - console.log(process.env) - console.log(parsedEnv); + 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 }