Skip to content

Instantly share code, notes, and snippets.

@toddgeist
Created June 7, 2016 17:14
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save toddgeist/ae38265218218681c917e2cf6f9ee6ef to your computer and use it in GitHub Desktop.
Save toddgeist/ae38265218218681c917e2cf6f9ee6ef 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.
@toddgeist
Copy link
Author

Deploying with now from https://zeit.co/

This was the easiest thing I could come up with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment