lib/elastic_apm/railtie.rb in elastic-apm-0.4.5 vs lib/elastic_apm/railtie.rb in elastic-apm-0.5.0
- old
+ new
@@ -5,19 +5,12 @@
class Railtie < Rails::Railtie
config.elastic_apm = ActiveSupport::OrderedOptions.new
Config::DEFAULTS.each { |option, value| config.elastic_apm[option] = value }
initializer 'elastic_apm.initialize' do |app|
- config = Config.new app.config.elastic_apm do |c|
- c.app = app
- end
+ config = app.config.elastic_apm.merge(app: app)
- file_config = load_config(app)
- file_config.each do |option, value|
- config.send(:"#{option}=", value)
- end
-
begin
ElasticAPM.start config
app.middleware.insert 0, Middleware
rescue StandardError => e
@@ -26,17 +19,8 @@
end
end
config.after_initialize do
require 'elastic_apm/injectors/action_dispatch'
- end
-
- private
-
- def load_config(app)
- config_path = app.root.join('config', 'elastic_apm.yml')
- return {} unless File.exist?(config_path)
-
- YAML.load_file(config_path) || {}
end
end
end