Class: Flagsmith::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/flagsmith/sdk/config.rb

Overview

Config options shared around Engine

Constant Summary collapse

DEFAULT_API_URL =
'https://edge.api.flagsmith.com/api/v1/'
OPTIONS =
%i[
  environment_key api_url custom_headers request_timeout_seconds enable_local_evaluation
  environment_refresh_interval_seconds retries enable_analytics default_flag_handler
  offline_mode offline_handler polling_manager_failure_limit logger
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Config

Returns a new instance of Config.



47
48
49
50
51
# File 'lib/flagsmith/sdk/config.rb', line 47

def initialize(options)
  build_config(options)

  freeze
end

Class Method Details

.environment_keyObject



100
101
102
# File 'lib/flagsmith/sdk/config.rb', line 100

def environment_key
  ENV.fetch('FLAGSMITH_ENVIRONMENT_KEY', nil)
end

Instance Method Details

#enable_analytics?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/flagsmith/sdk/config.rb', line 57

def enable_analytics?
  @enable_analytics
end

#environment_flags_urlObject



65
66
67
# File 'lib/flagsmith/sdk/config.rb', line 65

def environment_flags_url
  'flags/'
end

#environment_urlObject



73
74
75
# File 'lib/flagsmith/sdk/config.rb', line 73

def environment_url
  'environment-document/'
end

#identities_urlObject



69
70
71
# File 'lib/flagsmith/sdk/config.rb', line 69

def identities_url
  'identities/'
end

#local_evaluation?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/flagsmith/sdk/config.rb', line 53

def local_evaluation?
  @enable_local_evaluation
end

#offline_mode?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/flagsmith/sdk/config.rb', line 61

def offline_mode?
  @offline_mode
end