0

I have secret configuration that I do not want to commit to version control. The way Heroku deals with this is to set environment variables that can then be read by the app. This is a nice solution, and I'd like to use the same principle when using Passenger/nginx on my own server.

I can set these globally, e.g. in my .bash_profile, but this makes them available globally. If I have, for instance, two sites, both interacting with Twitter, and using TWITTER_API_KEY, this should be set differently for each site.

What I've found through Google suggests this isn't possible, but thought it worth asking anyway.


The alternative is to have a private config file that isn't committed into version control. That works, but using environment vars just seems more elegant to me.

Colin
  • 784
  • 2
  • 8
  • 21
  • Did you try env TWITTER_API_KEY="secret" in your nginx conf? (http://stackoverflow.com/questions/4735916/nginx-and-environment-variables-from-configuration-file) – sailor May 22 '12 at 16:43
  • That doesn't work. It errors regardless for me, but the linked article (http://forum.nginx.org/read.php?2,7124,7124) suggests it can't be done anyway. Figuring (hoping) there must be some elegant way though. – Colin May 22 '12 at 21:31

0 Answers0