-
-
Notifications
You must be signed in to change notification settings - Fork 25
Basic Usage
Jeff Felchner edited this page Dec 30, 2020
·
4 revisions
Before starting this guide, make sure you install chamber and initialize it.
Once your app is initialized, you should have a settings.yml
file somewhere.
A lot of times it's the root of your project and sometimes it's in a framework
specific location.
Inside of here you can define any settings you'd like like so:
# settings.yml
smtp_username: 'my_username'
smtp_password: 'my_password'
From there you can access your settings by using the special Chamber.dig
constant.
Chamber.dig('smtp_password')
# => 'my_password'
If you want to encrypt a setting, prefix the setting name with _secure_
like so:
# settings.yml
smtp_username: 'my_username'
_secure_smtp_password: 'my_password'
And then run chamber secure
. Your settings file will have an encrypted value:
# settings.yml
smtp_username: 'my_username'
_secure_smtp_password: JL5hAVux4tERpv49QPWxy9H0VC2Rnk7V8/e8+1XOwPcXcoH/a7Lh253UY/v9m8nI/Onb+ZG9nZ082J4M/BmLa+f7jwMEwufIqbUhUah9eKIW8xcxlppBYpl7JVGf2HJF5TfCN44gMQNgGNzboCQXKqRyeGFm4u772Sg9V2gEx/q7qJ6F4jg7v/cltCFLmJfXA2SHA5Dai4p9L4IvMVVJGm34k5j7KOegNqpVWs2RY99cagjPuzc9VM2XSUsXgqcUJdmH8YtPW8Kqkyg0oYlRh6VQWABlWXwTZz74QjTTjqtqfoELIoFTMBDh+cCvuUTAE5m06LhlqauVrB4UnBsd5g==
which you still access the same way because Chamber handles the decryption for you:
Chamber.dig('smtp_password')
# => 'my_password'
Next Step: File Layout
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