Skip to content

Commit

Permalink
Merge pull request #65 from alphagov/msw/bad
Browse files Browse the repository at this point in the history
Fix bad method invocation for enable_railtie_for?
  • Loading branch information
barrucadu authored Jan 3, 2019
2 parents cd085c3 + 0e1e0fe commit 5b26bf0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Fix crash on start due to incorrect method invocation.

# 1.11.0

* Disable X-Ray entirely if the `GOVUK_APP_CONFIG_DISABLE_XRAY`
Expand Down
12 changes: 6 additions & 6 deletions lib/govuk_app_config/railtie.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
module GovukAppConfig
class Railtie < Rails::Railtie
def self.enable_railtie_for?(name)
Rails.env.production? && !ENV.has_key?("GOVUK_APP_CONFIG_DISABLE_#{name.upcase}")
end

initializer('govuk_app_config') do |app|
GovukXRay.initialize(app) if enable_railtie_for?('xray')
GovukXRay.initialize(app) if self.enable_railtie_for?('xray')
end

config.before_initialize do
GovukLogging.configure if Rails.env.production?
end

config.after_initialize do
GovukXRay.start if enable_railtie_for?('xray')
end

def self.enable_railtie_for?(name)
Rails.env.production? && !ENV.has_key?("GOVUK_APP_CONFIG_DISABLE_#{name.upcase}")
GovukXRay.start if self.enable_railtie_for?('xray')
end
end
end

0 comments on commit 5b26bf0

Please sign in to comment.