Sha256: f1323ff53272ff11a42a32d6cc9d004efb3a331e69a93d099190dd080de6d2e6

Contents?: true

Size: 466 Bytes

Versions: 58

Compression:

Stored size: 466 Bytes

Contents

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

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

    def self.feature_in_env_var?(feature)
      (features =~ /\b#{feature}\b/i) != nil
    end

    def self.features
      ENV['PACT_BROKER_FEATURES'] || ""
    end
  end

  def self.feature_enabled?(feature)
    FeatureToggle.enabled?(feature)
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
pact_broker-2.65.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.64.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.63.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.62.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.61.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.60.1 lib/pact_broker/feature_toggle.rb
pact_broker-2.60.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.59.2 lib/pact_broker/feature_toggle.rb
pact_broker-2.59.1 lib/pact_broker/feature_toggle.rb
pact_broker-2.59.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.58.3 lib/pact_broker/feature_toggle.rb
pact_broker-2.58.2 lib/pact_broker/feature_toggle.rb
pact_broker-2.58.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.57.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.56.1 lib/pact_broker/feature_toggle.rb
pact_broker-2.56.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.55.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.54.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.53.0 lib/pact_broker/feature_toggle.rb
pact_broker-2.52.2 lib/pact_broker/feature_toggle.rb