Class: EasyCrypt::SecretsProvider::EnvProvider
- Defined in:
- lib/easy_crypt/secrets_provider/env_provider.rb
Overview
Provider that fetches encryption configuration from environment variables
Multiple credential purposes can be configured using environment variables. Each credential purpose requires three environment variables following this pattern:
EASY_CRYPT__CIPHER - (optional) Cipher to use for the encryption
falls back to EasyCrypt.default_cipher is not set
EASY_CRYPT__SALT - Salt value for the encryption EASY_CRYPT__SECRET - Secret key for the encryption
Where [PURPOSE] is the uppercase version of the credential purpose
You can set these variables in your .env file:
echo "EASY_CRYPT_AUTHENTICATION_CIPHER=aes128" >> .env
echo "EASY_CRYPT_AUTHENTICATION_SALT=your-salt" >> .env
echo "EASY_CRYPT_AUTHENTICATION_SECRET=your-secret" >> .env
Or export them directly in your environment:
export EASY_CRYPT_AUTHENTICATION_CIPHER=aes128
export EASY_CRYPT_AUTHENTICATION_SALT=your-salt
export EASY_CRYPT_AUTHENTICATION_SECRET=your-secret
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#cipher ⇒ String?
The encryption cipher from environment variable.
-
#salt ⇒ String?
The salt value from environment variable.
-
#secret ⇒ String?
The secret key from environment variable.
Methods inherited from Base
#initialize, #validate_attributes!
Constructor Details
This class inherits a constructor from EasyCrypt::SecretsProvider::Base
Instance Method Details
#cipher ⇒ String?
Returns The encryption cipher from environment variable.
49 50 51 |
# File 'lib/easy_crypt/secrets_provider/env_provider.rb', line 49 def cipher credentials('CIPHER') end |
#salt ⇒ String?
Returns The salt value from environment variable.
54 55 56 |
# File 'lib/easy_crypt/secrets_provider/env_provider.rb', line 54 def salt credentials('SALT') end |
#secret ⇒ String?
Returns The secret key from environment variable.
59 60 61 |
# File 'lib/easy_crypt/secrets_provider/env_provider.rb', line 59 def secret credentials('SECRET') end |