I\'m using Express and I need to use different credentials for each server (staging and production).
I could setup the variables in the server.coffee file but then I\'d
If you don't want the logic for determining which config to use in each file (which would look pretty ugly), you'll have to export it somewhere.
What I would suggest: Have a config.json
file containing the different configs. The main file requires it and does something like config.default = config.(condition ? 'production':'development')
. In all other files, you can now just do require('./config').default
.