Last active
November 16, 2020 02:17
-
-
Save wangpin34/cabd4042f5830ea17334ea7258237554 to your computer and use it in GitHub Desktop.
load env variables of different stacks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dotenv = require('dotenv') | |
const path = require('path') | |
const fs = require('fs') | |
function load() { | |
if (process.env.stack) { | |
return dotenv.config({ path: path.join(__dirname, `.env.${process.env.stack}`) }) | |
} | |
return dotenv.config() | |
} | |
load() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment