Class: Servitor::YamlConfigurationProvider

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

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ YamlConfigurationProvider

Returns a new instance of YamlConfigurationProvider.



5
6
7
# File 'lib/configuration/yaml_configuration_provider.rb', line 5

def initialize(file_path)
  @file_path = file_path
end

Instance Method Details

#resources_for(service_name) ⇒ Object



16
17
18
19
# File 'lib/configuration/yaml_configuration_provider.rb', line 16

def resources_for(service_name)
  resources = yaml['resources'] || {}
  resources[service_name] || {}
end

#variables_for(service_name) ⇒ Object



9
10
11
12
13
14
# File 'lib/configuration/yaml_configuration_provider.rb', line 9

def variables_for(service_name)
  services = yaml['services'] || {}
  service_vars = services[service_name] || {}
  common_vars = services['common'] || {}
  common_vars.merge(service_vars)
end