You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Note: this is an example usage, it is easier to just use the default local files `settings.local.yml,
194
-
settings/#{Rails.env}.local.yml and environments/#{Rails.env}.local.yml` for your developer specific settings.
193
+
> Note: this is an example usage, it is easier to just use the default local
194
+
> files `settings.local.yml`, `settings/#{Rails.env}.local.yml` and
195
+
> `environments/#{Rails.env}.local.yml` for your developer specific settings.
195
196
196
197
You also have the option to add a raw hash as a source. One use case might be storing settings in the database or in environment variables that overwrite what is in the YML files.
It is considered an error to use environment variables to simutaneously assign a "flat" value and a multi-level value to a key.
424
+
425
+
```ruby
426
+
# Raises an error when settings are loaded
427
+
ENV['BACKEND_DATABASE'] = 'development'
428
+
ENV['BACKEND_DATABASE_USER'] = 'postgres'
429
+
```
430
+
431
+
Instead, specify keys of equal depth in the environment variable names:
432
+
433
+
```ruby
434
+
ENV['BACKEND_DATABASE_NAME'] = 'development'
435
+
ENV['BACKEND_DATABASE_USER'] = 'postgres'
436
+
```
437
+
422
438
### Working with Heroku
423
439
424
440
Heroku uses ENV object to store sensitive settings. You cannot upload such files to Heroku because it's ephemeral filesystem gets recreated from the git sources on each instance refresh. To use config with Heroku just set the `use_env` var to `true` as mentioned above.
0 commit comments