lib/logstasher/railtie.rb in logstasher-1.4.0 vs lib/logstasher/railtie.rb in logstasher-2.0.0
- old
+ new
@@ -15,16 +15,16 @@
config.logstasher.view_enabled = true
config.logstasher.job_enabled = true
# Try loading the config/logstasher.yml if present
env = Rails.env.to_sym || :development
- config_file = File.expand_path "./config/logstasher.yml"
+ config_file = File.expand_path './config/logstasher.yml'
# Load and ERB templating of YAML files
- LOGSTASHER = File.exists?(config_file) ? YAML.load(ERB.new(File.read(config_file)).result).symbolize_keys : nil
+ LOGSTASHER = File.exist?(config_file) ? YAML.load(ERB.new(File.read(config_file)).result).symbolize_keys : nil
- initializer :logstasher, :before => :load_config_initializers do |app|
+ initializer :logstasher, before: :load_config_initializers do |app|
if LOGSTASHER.present?
# process common configs
LogStasher.process_config(app.config.logstasher, LOGSTASHER)
# process environment specific configs
LogStasher.process_config(app.config.logstasher, LOGSTASHER[env].symbolize_keys) if LOGSTASHER.key? env
@@ -77,8 +77,10 @@
config.source = yml_config.key?(:source) ? yml_config[:source] : default_source
config.backtrace = yml_config[:backtrace] if yml_config.key? :backtrace
config.logger_path = yml_config[:logger_path] if yml_config.key? :logger_path
config.log_level = yml_config[:log_level] if yml_config.key? :log_level
- config.log_controller_parameters = yml_config[:log_controller_parameters] if yml_config.key? :log_controller_parameters
+ if yml_config.key? :log_controller_parameters
+ config.log_controller_parameters = yml_config[:log_controller_parameters]
+ end
end
end