Class: LittleGhost::Providers::Configuration

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#connectionsObject (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