Class: Librato::Rails::Configuration
- Inherits:
-
Rack::Configuration
- Object
- Rack::Configuration
- Librato::Rails::Configuration
- Defined in:
- lib/librato/rails/configuration.rb
Overview
Adds yaml-based config and extra properties to the configuration class provided by librato-rack
github.com/librato/librato-rack/blob/master/lib/librato/rack/configuration.rb
Constant Summary collapse
- CONFIG_SETTABLE =
%w{user token flush_interval log_level prefix source source_pids proxy suites}
- DEFAULT_SUITES =
[:rails_action, :rails_cache, :rails_controller, :rails_mail, :rails_method, :rails_render, :rails_sql, :rails_status, :rails_job]
Instance Attribute Summary collapse
-
#config_by ⇒ Object
Returns the value of attribute config_by.
-
#config_file ⇒ Object
Returns the value of attribute config_file.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Configuration
constructor
options: * :config_file - alternate config file location.
-
#load_configuration ⇒ Object
detect and load configuration from config file or env vars.
Constructor Details
#initialize(options = {}) ⇒ Configuration
options:
-
:config_file - alternate config file location
20 21 22 23 24 |
# File 'lib/librato/rails/configuration.rb', line 20 def initialize(={}) self.config_file = [:config_file] || 'config/librato.yml' super() self.log_prefix = '[librato-rails] ' end |
Instance Attribute Details
#config_by ⇒ Object
Returns the value of attribute config_by.
15 16 17 |
# File 'lib/librato/rails/configuration.rb', line 15 def config_by @config_by end |
#config_file ⇒ Object
Returns the value of attribute config_file.
15 16 17 |
# File 'lib/librato/rails/configuration.rb', line 15 def config_file @config_file end |
Instance Method Details
#load_configuration ⇒ Object
detect and load configuration from config file or env vars
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/librato/rails/configuration.rb', line 27 def load_configuration if self.config_file && File.exists?(self.config_file) configure_with_config_file else self.config_by = :environment super end # respect autorun and log_level env vars regardless of config method self.autorun = detect_autorun self.log_level = :info if log_level.blank? self.suites = '' if suites.nil? self.log_level = ENV['LIBRATO_LOG_LEVEL'] if ENV['LIBRATO_LOG_LEVEL'] end |