Sha256: 1638abdab50dbc0453638cf4be26352522e8193751e26296d88d7ad93e967f62

Contents?: true

Size: 598 Bytes

Versions: 37

Compression:

Stored size: 598 Bytes

Contents

require "pact_broker/config/runtime_configuration"

module PactBroker
  class FeatureToggle
    def self.enabled?(feature, ignore_env)
      if ignore_env
        feature_in_env_var?(feature)
      else
        not_production? || feature_in_env_var?(feature)
      end
    end

    def self.not_production?
      ENV["RACK_ENV"] != "production"
    end

    def self.feature_in_env_var?(feature)
      PactBroker.configuration.features.include?(feature.to_s.downcase)
    end
  end

  def self.feature_enabled?(feature, ignore_env = false)
    FeatureToggle.enabled?(feature, ignore_env)
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
pact_broker-2.93.3 lib/pact_broker/feature_toggle.rb
pact_broker-2.93.2 lib/pact_broker/feature_toggle.rb
pact_broker-2.93.1 lib/pact_broker/feature_toggle.rb
pact_broker-2.93.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.92.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.91.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.90.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.89.1 lib/pact_broker/feature_toggle.rb
pact_broker-2.89.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.88.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.87.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.86.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.85.1 lib/pact_broker/feature_toggle.rb
pact_broker-2.85.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.84.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.83.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.82.0 lib/pact_broker/feature_toggle.rb