Skip to content

Instantly share code, notes, and snippets.

@flybayer
Forked from toddgeist/start.js
Created August 30, 2016 15:58
Show Gist options
  • Save flybayer/8908acdf61e3adbf1f571efe6a8e31b0 to your computer and use it in GitHub Desktop.
Save flybayer/8908acdf61e3adbf1f571efe6a8e31b0 to your computer and use it in GitHub Desktop.
Using dotenv to load vars when dploying to now. But still keep it out of your repo.
// load as early as possible
if(process.env.NOW){
require('dotenv').config({path:'./.envnow', silent:true});
}else{
require('dotenv').config({silent:true});
}
// now you can deploy with:
//$cp .env .envnow && now && rm -r .envnow
//this will copy current .env to .envnow, then deploy to now, then delete the .envnow file
//so it stays out of your repo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment