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.107.1 lib/pact_broker/feature_toggle.rb
pact_broker-2.107.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.107.0.beta.1 lib/pact_broker/feature_toggle.rb
pact_broker-2.106.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.105.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.104.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.103.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.102.2 lib/pact_broker/feature_toggle.rb
pact_broker-2.102.1 lib/pact_broker/feature_toggle.rb
pact_broker-2.102.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.101.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.100.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.99.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.98.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.97.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.96.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.95.1 lib/pact_broker/feature_toggle.rb
pact_broker-2.95.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.94.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.93.4 lib/pact_broker/feature_toggle.rb