Class: Etna::Clients::Polyphemus::SetConfigurationWorkflow
- Inherits:
-
Struct
- Object
- Struct
- Etna::Clients::Polyphemus::SetConfigurationWorkflow
- Defined in:
- lib/etna/clients/polyphemus/workflows/set_configuration_workflow.rb
Instance Attribute Summary collapse
-
#config_file ⇒ Object
Returns the value of attribute config_file.
-
#polyphemus_client ⇒ Object
Returns the value of attribute polyphemus_client.
Instance Method Summary collapse
Instance Attribute Details
#config_file ⇒ Object
Returns the value of attribute config_file
20 21 22 |
# File 'lib/etna/clients/polyphemus/workflows/set_configuration_workflow.rb', line 20 def config_file @config_file end |
#polyphemus_client ⇒ Object
Returns the value of attribute polyphemus_client
20 21 22 |
# File 'lib/etna/clients/polyphemus/workflows/set_configuration_workflow.rb', line 20 def polyphemus_client @polyphemus_client end |
Instance Method Details
#fetch_configuration ⇒ Object
21 22 23 |
# File 'lib/etna/clients/polyphemus/workflows/set_configuration_workflow.rb', line 21 def fetch_configuration polyphemus_client.configuration end |
#update_configuration_file(**additional_config) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/etna/clients/polyphemus/workflows/set_configuration_workflow.rb', line 25 def update_configuration_file(**additional_config) if File.exist?(config_file) etna_config = YAML.load_file(config_file) || {} else etna_config = {} end config = polyphemus_client.configuration env = config.environment.to_sym # Ensure that env is the last key in the result, which becomes the new 'default' config. etna_config.delete(env) if etna_config.include?(env) env_config = config.environment_configuration.raw.dup env_config.update(additional_config) etna_config.update({ env => env_config }) File.open(config_file, 'w') { |f| YAML.dump(etna_config, f) } config end |