Class: LittleGhost::Providers::Configuration
- Inherits:
-
Object
- Object
- LittleGhost::Providers::Configuration
- Defined in:
- lib/little_ghost/providers/configuration.rb
Overview
Holds trusted provider connection settings independently from model profiles. Connection names and option keys are normalized to strings, and the resulting mapping is immutable.
Instance Attribute Summary collapse
-
#connections ⇒ Object
readonly
Normalized provider connections keyed by application-defined name.
Instance Method Summary collapse
-
#credentials(provider:, adapter:, configuration:) ⇒ Object
Returns credentials merged into
configurationwhenprovideris constructed withadapter. -
#initialize(connections = {}) ⇒ Configuration
constructor
Copies and freezes
connectionsso callers may safely reuse their input.
Constructor Details
#initialize(connections = {}) ⇒ Configuration
Copies and freezes connections so callers may safely reuse their input.
13 14 15 16 17 18 19 20 21 |
# File 'lib/little_ghost/providers/configuration.rb', line 13 def initialize(connections = {}) unless connections.is_a?(Hash) raise ConfigurationError, "providers must be a mapping" end @connections = normalize(connections).freeze validate! freeze end |
Instance Attribute Details
#connections ⇒ Object (readonly)
Normalized provider connections keyed by application-defined name.
10 11 12 |
# File 'lib/little_ghost/providers/configuration.rb', line 10 def connections @connections end |
Instance Method Details
#credentials(provider:, adapter:, configuration:) ⇒ Object
Returns credentials merged into configuration when provider is
constructed with adapter. Subclasses may resolve secrets lazily here.
The base implementation adds no credentials.
26 27 28 |
# File 'lib/little_ghost/providers/configuration.rb', line 26 def credentials(provider:, adapter:, configuration:) {} end |