For logging, connection strings or even code that should behave differently (if there is such a thing).
Env vars are used very much.
Other approach is:
Having config.yaml (or any format) file which has constants eg. connection_url, db_hosts etc. And this file is not committed in repo. For dev/local purposes have a configs.yaml.sample file with defaults settings.
Sabine Hofmann
One should always use environment variables to differentiate between development and production environments. I keep a config file to define various variables, connection strings etc. If the variables are set in environment I utilize them otherwise I use the default values meant for local usage . For example, a connection URL in config file may be initialized as following :
In development mode
connectionwill point tolocalConnectionStringwhile in production mode it'll be initialized withprocess.env.connectionString. In fact if you use PaaS solutions like OpenShift, Heroku etc you are expected to follow these standards.