Skip to content

Configuring with environment variables

Erik Hetzner edited this page Mar 27, 2018 · 1 revision

Aperta uses the Dotenv gem to manage its environment variables. All necessary files should be generated by the bin/setup script.

There are 3 important environment files: .env, .env.(development/test) (the RAILS_ENV environment variable will determine which file is used), and .env.local. Dotenv will load them in that order. Settings from .env will be overridden in the .env.(development/test), which will be overridden by the .env.local. Only the .env and .env.test files are checked in. The .env file specifies some reasonable defaults for most developer setups.

It is recommended to make machine specific modifications to the .env.development. Making changes to the .env.local will override any settings from the .env.test (this can lead to surprising differences between your machine and the CI server). This differs from the "Dotenv best practices" which encourage making local changes to .env.local; we do not recommend that approach.

foreman can also load environment variables. It is recommended that you do not use it for this purpose, as interaction with dotenv can lead to bizarre .env file load orders. Your .foreman file should contain the line:

env: ''

to prevent .env file loading.

Clone this wiki locally