Class: Featureflow::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/featureflow/configuration.rb

Constant Summary collapse

DEFAULT_ENDPOINT =
'https://app.featureflow.io'
DEFAULT_EVENT_ENDPOINT =
'https://events.featureflow.io'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



12
13
14
15
16
17
18
19
20
21
# File 'lib/featureflow/configuration.rb', line 12

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

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



2
3
4
# File 'lib/featureflow/configuration.rb', line 2

def api_key
  @api_key
end

#disable_eventsObject

Returns the value of attribute disable_events.



5
6
7
# File 'lib/featureflow/configuration.rb', line 5

def disable_events
  @disable_events
end

#endpointObject

Returns the value of attribute endpoint.



3
4
5
# File 'lib/featureflow/configuration.rb', line 3

def endpoint
  @endpoint
end

#event_endpointObject

Returns the value of attribute event_endpoint.



4
5
6
# File 'lib/featureflow/configuration.rb', line 4

def event_endpoint
  @event_endpoint
end

#loggerObject

Returns the value of attribute logger.



7
8
9
# File 'lib/featureflow/configuration.rb', line 7

def logger
  @logger
end

#with_featuresObject

Returns the value of attribute with_features.



6
7
8
# File 'lib/featureflow/configuration.rb', line 6

def with_features
  @with_features
end

Instance Method Details

#validate!Object



23
24
25
26
27
# File 'lib/featureflow/configuration.rb', line 23

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