Sha256: f158969eb9a8caa8c165642da1e0b76834b10857a28c6559dd322245767a51a5
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
module ProfileIt class Config DEFAULTS = { 'host' => 'https://profileit.io', 'log_level' => 'info', # changed from info for dev 'name' => 'LOCAL APP' } def initialize(config_path = nil) @config_path = config_path end def settings return @settings if @settings load_file end def config_path @config_path || File.join(ProfileIt::Agent.instance.environment.root,"config","profile_it.yml") end def config_file File.expand_path(config_path) end def load_file begin if !File.exist?(config_file) ProfileIt::Agent.instance.logger.warn "No config file found at [#{config_file}]." @settings = {} else @settings = YAML.load(ERB.new(File.read(config_file)).result(binding))[ProfileIt::Agent.instance.environment.env] || {} end rescue Exception => e ProfileIt::Agent.instance.logger.warn "Unable to load the config file." ProfileIt::Agent.instance.logger.warn e.message ProfileIt::Agent.instance.logger.warn e.backtrace @settings = {} end @settings = DEFAULTS.merge(@settings) end end # Config end # ProfileIt
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
profile_it-0.2.9 | lib/profile_it/config.rb |