Method: BoltServer::BaseConfig#load_file_config

Defined in:
lib/bolt_server/base_config.rb

#load_file_config(path) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/bolt_server/base_config.rb', line 52

def load_file_config(path)
  @config_path = path
  begin
    # This lets us get the actual config values without needing to
    # know the service name
    parsed_hocon = Hocon.load(path)[service_name]
  rescue Hocon::ConfigError => e
    raise "Hocon data in '#{path}' failed to load.\n Error: '#{e.message}'"
  rescue Errno::EACCES
    raise "Your user doesn't have permission to read #{path}"
  end

  raise "Could not find service config at #{path}" if parsed_hocon.nil?

  parsed_hocon = parsed_hocon.select { |key, _| config_keys.include?(key) }

  @data = @data.merge(parsed_hocon)
end