-
-
Notifications
You must be signed in to change notification settings - Fork 25
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.yml
settings-development.yml.erb
settings-devbox.yml
settings-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.yml
settings/email/addresses-development.yml
settings/email/addresses-devbox.yml
settings/email/smtp/servers.yml
settings/email/smtp/servers-development.yml
settings/email/smtp/servers-devbox.yml
settings/http/main.yml
settings/http/main-development.yml
settings/http/main-devbox.yml
settings/sidekiq/queues.yml
settings/sidekiq/queues-development.yml
settings/sidekiq/queues-devbox.yml
settings/redis.yml
settings/redis-development.yml
settings/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