Sha256: 3063564881920a1b4e7676f7ea62da2845c9f6ea8e959d6b85acc63f41950561
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
class Featureflow::Configuration attr_accessor :api_key attr_accessor :endpoint attr_accessor :event_endpoint attr_accessor :disable_events attr_accessor :with_features attr_accessor :logger DEFAULT_ENDPOINT = 'https://app.featureflow.io' DEFAULT_EVENT_ENDPOINT = 'https://events.featureflow.io' def initialize self.api_key = ENV["FEATUREFLOW_SERVER_KEY"] self.endpoint = DEFAULT_ENDPOINT self.event_endpoint = DEFAULT_EVENT_ENDPOINT self.disable_events = false self.with_features = [] self.logger = Logger.new(STDOUT) self.logger.level = Logger::WARN end def validate! unless with_features_valid? @with_features raise ArgumentError, 'with_features must be an array of Feature hashes. Use Featureflow::Feature.create(key, failover_variant)' end end private def with_features_valid?(features) features.all? do |feature| feature[:key].is_a?(String) && feature[:failover_variant].is_a?(String) && feature[:variants].is_a?(Array) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
featureflow-0.6.0 | lib/featureflow/configuration.rb |