Class: EasyCrypt::SecretsProvider
- Inherits:
-
Object
- Object
- EasyCrypt::SecretsProvider
- Defined in:
- lib/easy_crypt/secrets_provider.rb,
lib/easy_crypt/secrets_provider/base.rb,
lib/easy_crypt/secrets_provider/env_provider.rb,
lib/easy_crypt/secrets_provider/rails_credentials_provider.rb
Overview
The SecretsProvider class serves as a factory for creating secret providers that supply encryption configuration values from different sources.
Defined Under Namespace
Classes: Base, EnvProvider, RailsCredentialsProvider
Constant Summary collapse
- PROVIDERS =
Available secrets providers and their corresponding classes
{ env_vars: EnvProvider, rails_credentials: RailsCredentialsProvider }.freeze
Class Method Summary collapse
-
.build(provider, purpose) ⇒ Base
Builds a new secrets provider instance based on the specified provider.
Class Method Details
.build(provider, purpose) ⇒ Base
Builds a new secrets provider instance based on the specified provider
This method acts as a factory for instantiating a secrets provider that fetches encryption configurations (e.g., secret keys, salts) for a given purpose from the selected source. The method ensures the specified provider exists and validates the configuration values.
45 46 47 48 49 50 51 |
# File 'lib/easy_crypt/secrets_provider.rb', line 45 def self.build(provider, purpose) provider = PROVIDERS .fetch(provider.to_sym) { raise InvalidSecretsProvider, provider } .new(purpose) provider.validate_attributes! provider end |