Skip to content

Commit

Permalink
Merge pull request #793 from bedgerotto/main
Browse files Browse the repository at this point in the history
Fix: Define default_strict_value before it's called
  • Loading branch information
jnunemaker authored Dec 16, 2023
2 parents 4f5a76a + f29f19d commit f6f819a
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions lib/flipper/engine.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
module Flipper
class Engine < Rails::Engine
def self.default_strict_value
value = ENV["FLIPPER_STRICT"]
if value.in?(["warn", "raise", "noop"])
value.to_sym
elsif value
Typecast.to_boolean(value) ? :raise : false
elsif Rails.env.production?
false
else
# Warn for now. Future versions will default to :raise in development and test
:warn
end
end

paths["config/routes.rb"] = ["lib/flipper/cloud/routes.rb"]

config.before_configuration do
Expand Down Expand Up @@ -70,20 +84,6 @@ def cloud?
!!ENV["FLIPPER_CLOUD_TOKEN"]
end

def self.default_strict_value
value = ENV["FLIPPER_STRICT"]
if value.in?(["warn", "raise", "noop"])
value.to_sym
elsif value
Typecast.to_boolean(value) ? :raise : false
elsif Rails.env.production?
false
else
# Warn for now. Future versions will default to :raise in development and test
:warn
end
end

def self.deprecated_rails_version?
Gem::Version.new(Rails.version) < Gem::Version.new(Flipper::NEXT_REQUIRED_RAILS_VERSION)
end
Expand Down

0 comments on commit f6f819a

Please sign in to comment.