Module: Thron::Config

Extended by:
Config
Included in:
Config
Defined in:
lib/thron/config.rb

Constant Summary collapse

CONFIG_YML =
Thron::root.join('config', 'thron.yml')

Instance Method Summary collapse

Instance Method Details

#circuit_breakerObject



27
28
29
# File 'lib/thron/config.rb', line 27

def circuit_breaker
  @circuit_breaker ||= OpenStruct.new(dump_yaml['circuit_breaker'])
end

#dump_yamlObject



14
15
16
17
# File 'lib/thron/config.rb', line 14

def dump_yaml
  Dotenv.load
  @yaml ||= YAML.load(ERB.new(File.read(CONFIG_YML)).result)
end

#loggerObject



19
20
21
22
23
24
25
# File 'lib/thron/config.rb', line 19

def logger
  @logger ||= begin
                level = dump_yaml.fetch('logger').fetch('level')
                verbose = dump_yaml.fetch('logger').fetch('verbose')
                OpenStruct.new(level: Logger::const_get(level.upcase), verbose: verbose)
              end
end

#thronObject



31
32
33
# File 'lib/thron/config.rb', line 31

def thron
  @thron ||= OpenStruct.new(dump_yaml['thron'])
end