Class: Servitor::ConfigurationResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/configuration/configuration_resolver.rb

Defined Under Namespace

Classes: DependentServiceNotFound, MissingRequiredVariable, ResourceNotFound, VariableConflict

Instance Method Summary collapse

Constructor Details

#initialize(service_definition, configuration_provider, services) ⇒ ConfigurationResolver

Returns a new instance of ConfigurationResolver.



4
5
6
7
8
# File 'lib/configuration/configuration_resolver.rb', line 4

def initialize(service_definition, configuration_provider, services)
  @service_definition = service_definition
  @configuration_provider = configuration_provider
  @services = services
end

Instance Method Details

#variablesObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/configuration/configuration_resolver.rb', line 10

def variables
  @variables ||= begin
    vars = resolve_variables(service_configuration.variables)
    service_configuration.resources.each do |resource_configuration|
      vars.merge!(resolve_resource_variables(resource_configuration)) do |key, _, _|
        raise VariableConflict, "'#{key}' is defined more than once"
      end
    end
    vars
  end
end