-
-
Notifications
You must be signed in to change notification settings - Fork 25
Loading Keys From Environment Variables
Chamber provides the ability to sync with any service that provides access to environment variables by sending your private key. This will be stored server side with whatever service you send it to. Then, when your application runs, Chamber will first look to see if the environment variable containing the private key exists, if it does, it will use its contents to decrypt your settings.
In all of our other examples in this guide, we've assumed that we're running Chamber on a system where we have direct access to the filesystem. On systems like CI and Heroku, this is much less the case and, if we want to provide our keypairs, we need a different way.
When Chamber encrypts or decrypts values, it doesn't just look for key files, it also (and in fact first) looks for special environment variables.
In the case of the default key, it looks for:
CHAMBER_KEY
CHAMBER_PUBLIC_KEY
In the case of namespaced keys, it looks for:
CHAMBER_NAMESPACE_KEY
CHAMBER_NAMESPACE_PUBLIC_KEY
where NAMESPACE
would be replaced by the actual namespace (eg PRODUCTION
)
(if you haven't read up on namespaced keys, you can do so
here).
These environment variables should contain the verbatim data stored in the corresponding key file.
If you're deploying, you only need to set the private key. This means that if
you're only using the default Chamber key, the only environment variable you
need to set is CHAMBER_KEY
.
So now that we know we can set our private keys as environment variables, how do we do it?
Check out this page for information about integrating with some of the most popular cloud services.
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