Method: Rdm::ConfigManager#update_using_file

Defined in:
lib/rdm/config_manager.rb

#update_using_file(path, raise_if_missing: true) ⇒ Object

Update configuration using given path to config file

Parameters:

  • config (Hash<String: AnyValue>)

    Hash with configuration

Returns:

  • root scope [Rdm::ConfigScope] Updated root scope



23
24
25
26
27
28
29
30
31
32
# File 'lib/rdm/config_manager.rb', line 23

def update_using_file(path, raise_if_missing: true)
  if File.exist?(path)
    compiled_file = ::ERB.new(File.read(path)).result
    hash = YAML.load(compiled_file)
    update_using_hash(hash)
  elsif raise_if_missing
    raise "Config file is not found at path #{path}"
  end
  root_scope
end