-
-
Notifications
You must be signed in to change notification settings - Fork 24
File Based Namespaces
So far we've only looked at what we call "Inline Namespaces", where the namespaces are nested inside a settings file, but Chamber also allows you to completely separate a namespace into another file.
If we were using one of our offical plugins, which loads a namespace for the environment as well as a namespace for the current hostname, Chamber attempts to auto-detect other files you might want to load.
For this example we're going to assume we're loading a project in development
and that our hostname is devbox.
While Chamber will always load settings.yml if it exists, when namespaces
are specified, it would also attempt to load:
settings-development.ymlsettings-development.yml.erbsettings-devbox.ymlsettings-devbox.yml.erb
This also goes for any files in your settings subdirectory. Each file gets
this treatment. If your settings subdirectory looked like this:
<basepath>/settings
|
|-- email
| |
| |-- addresses.yml
| |-- smtp
| |
| |-- servers.yml
|
|-- http
| |
| |-- main.yml
|
|-- sidekiq
| |
| |-- queues.yml
|
|-- redis.yml.erb
Chamber will load:
settings/email/addresses.ymlsettings/email/addresses-development.ymlsettings/email/addresses-devbox.ymlsettings/email/smtp/servers.ymlsettings/email/smtp/servers-development.ymlsettings/email/smtp/servers-devbox.ymlsettings/http/main.ymlsettings/http/main-development.ymlsettings/http/main-devbox.ymlsettings/sidekiq/queues.ymlsettings/sidekiq/queues-development.ymlsettings/sidekiq/queues-devbox.ymlsettings/redis.ymlsettings/redis-development.ymlsettings/redis-devbox.yml
in that order. The settings in any later files will override settings in any earlier files.
Note: One of the biggest advantages to this approach is that it allows you to easily gitignore settings for an entire namespace (eg
settings/*-production.yml)
This file-based approach is more commonly used to keep all your production settings in separate files which are then stored outside the repository. However with Chamber that is not a use case we find useful since you can just encrypt your settings using a namespace key pair.
In general, most Chamber users always use inline namespaces.
Copyright ©2023
- Release News
- Gem Comparison
- 12-Factor App Rebuttal
- Environment Variable Problems
- Installation
- Basics
- Defining Settings
- Accessing Settings
- Verifying Settings
- Namespaces
- Environment Variables
- Integrations
- Encryption
- Advanced Usage
- Command Line Reference