Skip to content

Instantly share code, notes, and snippets.

@wangpin34
Last active November 16, 2020 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wangpin34/cabd4042f5830ea17334ea7258237554 to your computer and use it in GitHub Desktop.
Save wangpin34/cabd4042f5830ea17334ea7258237554 to your computer and use it in GitHub Desktop.
load env variables of different stacks
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