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}
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
18 19 20 21 22 |
# File 'lib/librato/rails/configuration.rb', line 18 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.
13 14 15 |
# File 'lib/librato/rails/configuration.rb', line 13 def config_by @config_by end |
#config_file ⇒ Object
Returns the value of attribute config_file.
13 14 15 |
# File 'lib/librato/rails/configuration.rb', line 13 def config_file @config_file end |
Instance Method Details
#load_configuration ⇒ Object
detect and load configuration from config file or env vars
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/librato/rails/configuration.rb', line 25 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.log_level = ENV['LIBRATO_LOG_LEVEL'] if ENV['LIBRATO_LOG_LEVEL'] end |