Class: Appsignal::Config
- Inherits:
-
Object
- Object
- Appsignal::Config
- Defined in:
- lib/appsignal/config.rb
Instance Attribute Summary collapse
-
#rails_env ⇒ Object
Returns the value of attribute rails_env.
-
#root_path ⇒ Object
Returns the value of attribute root_path.
Instance Method Summary collapse
-
#initialize(root_path, rails_env, logger = Appsignal.logger) ⇒ Config
constructor
A new instance of Config.
- #load ⇒ Object
Constructor Details
#initialize(root_path, rails_env, logger = Appsignal.logger) ⇒ Config
Returns a new instance of Config.
5 6 7 8 9 |
# File 'lib/appsignal/config.rb', line 5 def initialize(root_path, rails_env, logger=Appsignal.logger) @root_path = root_path @rails_env = rails_env @logger = logger end |
Instance Attribute Details
#rails_env ⇒ Object
Returns the value of attribute rails_env.
3 4 5 |
# File 'lib/appsignal/config.rb', line 3 def rails_env @rails_env end |
#root_path ⇒ Object
Returns the value of attribute root_path.
3 4 5 |
# File 'lib/appsignal/config.rb', line 3 def root_path @root_path end |
Instance Method Details
#load ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/appsignal/config.rb', line 11 def load file = File.join(@root_path, 'config/appsignal.yml') unless File.exists?(file) @logger.error "config not found at: #{file}" return end config = YAML.load_file(file)[@rails_env] unless config @logger.error "config for '#{@rails_env}' not found" return end config = {:ignore_exceptions => [], :endpoint => 'https://push.appsignal.com/1', :slow_request_threshold => 200 }.merge(config.symbolize_keys) end |