splitclient-rb 5.1.3.pre.rc2-java → 5.1.3.pre.rc3-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6cb0311b168fb12d22bf8b707f307095383b9017
4
- data.tar.gz: 90da2fd289742ed147bc2f1ba4604f94bf7b877f
3
+ metadata.gz: e9e8ced8272ff8af84bff37888fa388901c59304
4
+ data.tar.gz: 6ce3fd691a9672b809fa561dd3e38d63fad509e8
5
5
  SHA512:
6
- metadata.gz: ab58655555d5889e00b4eea5c1e7a851f412e3c6b23845eed34f2c44725762fbb518c3acbc9edf738ec37901049db3c23a61de28aaf132ab34bd6f39af83e5c8
7
- data.tar.gz: 6067f1366ccbe092b5b4595d57b001c630c9f7d0e7101888f17bbc3670699bb002ba1a82ee479c03483aa35f5dc1caafe43e2ab6bc6447287aa92d6da91ea28a
6
+ metadata.gz: 27e35704774d40d32e0d0c2a334c131711a571cac58c7718e0ea536680ef2b21f901dbadf4faf1dd21b4d67b6fab7904e15172652cffc28eebf446f36c45bdf1
7
+ data.tar.gz: d8249bcb7e494061d864eff9fe5aaf8e3db6dbd5eb589c9ce540f2856be89fa881c550cacd45da8e3a7bd71b7c8b441df30eec49687f2cc12e05494352b95760
@@ -11,7 +11,6 @@ Metrics/BlockLength:
11
11
  Exclude:
12
12
  - spec/**/*
13
13
  - splitclient-rb.gemspec
14
- - exe/splitio
15
14
 
16
15
  Naming/FileName:
17
16
  Exclude:
@@ -72,6 +72,17 @@ else
72
72
  end
73
73
  ```
74
74
 
75
+ **Note**: You can ensure the SDK resources are loaded before querying for treatments by using `block_until_ready`. See [Advanced Configuration](#advanced-configuration).
76
+ ``` ruby
77
+ options = {
78
+ block_until_ready: 10
79
+ }
80
+
81
+ # Then init the factory passing the options hash
82
+ factory = SplitIoClient::SplitFactoryBuilder.build('YOUR_API_KEY', options)
83
+ split_client = factory.client
84
+ ```
85
+
75
86
  For features that use targeting rules based on user attributes, you can call the `get_treatment` method the following way:
76
87
 
77
88
  ```ruby
@@ -239,7 +250,7 @@ The following values can be customized:
239
250
 
240
251
  *default value* = `60`
241
252
 
242
- **impressions_queue_size** : The size of the impressions queue in case of `cache_adapter == :memory`.
253
+ **impressions_queue_size** : The size of the impressions queue in case of `cache_adapter == :memory`. When the queue is full, existing impressions will be dropped.
243
254
 
244
255
  *default value* = 5000
245
256
 
@@ -247,6 +258,10 @@ The following values can be customized:
247
258
 
248
259
  *default value* = defaults to `impressions_queue_size`
249
260
 
261
+ **events_queue_size** : The size of the events queue in case of `cache_adapter == :memory`. When the queue is full, existing events will be dropped.
262
+
263
+ *default value* = 500
264
+
250
265
  **debug_enabled** : Enables extra logging (verbose mode).
251
266
 
252
267
  *default value* = `false`
@@ -329,15 +344,9 @@ options = {
329
344
 
330
345
  ```ruby
331
346
  options = {
332
- connection_timeout: 10,
333
- read_timeout: 5,
334
- features_refresh_rate: 120,
335
- segments_refresh_rate: 120,
336
- metrics_refresh_rate: 360,
337
- impressions_refresh_rate: 360,
338
- logger: Logger.new('logfile.log'),
347
+ # other options
339
348
  cache_adapter: :redis,
340
- mode: :standalone,
349
+ mode: :consumer,
341
350
  redis_url: 'redis://127.0.0.1:6379/0'
342
351
  }
343
352
  begin
@@ -388,10 +397,10 @@ In the example above, the listener simply takes an impression and logs it to the
388
397
 
389
398
  The SDK is capable of running in two different modes to fit in different infrastructure configurations:
390
399
 
391
- - `:standalone` - (default) : The SDK will retrieve information (e.g. split definitions) periodically from the Split servers, and store it in the chosen cache (memory / Redis). It'll also store the application execution information (e.g. impressions) in the cache and send it periodically to the Split servers. As it name implies, in this mode, the SDK neither relies nor synchronizes with any other component.
392
- - `:consumer` - If using a load balancer or more than one SDK in your application, guaranteeing that all changes in split definitions are picked up by all SDK instances at the same time is highly recommended in order to ensure consistent results across your infrastructure (i.e. getting the same treatment for a specific split and user pair). To achieve this, use the [Split Synchronizer](https://docs.split.io/docs/split-synchronizer)) and setup your SDKs to work in the `consumer` mode. Setting the components this way, all communication with the Split server is orchestrated by the Synchronizer, while the SDKs pick up definitions and store the execution information from / into a shared Redis data store.
400
+ - `:standalone` - (default) : The SDK will retrieve information (e.g. split definitions) periodically from the Split servers, and store it in the memory cache. It'll also store the application execution information (e.g. impressions) in the cache and send it periodically to the Split servers. As it name implies, in this mode, the SDK neither relies nor synchronizes with any other component. _This mode is only available when using the `memory` cache adapter._
401
+ - `:consumer` - If using a load balancer or more than one SDK in your application, guaranteeing that all changes in split definitions are picked up by all SDK instances at the same time is highly recommended in order to ensure consistent results across your infrastructure (i.e. getting the same treatment for a specific split and user pair). To achieve this, use the [Split Synchronizer](https://docs.split.io/docs/split-synchronizer)) and setup your SDKs to work in the `consumer` mode. Setting the components this way, all communication with the Split server is orchestrated by the Synchronizer, while the SDKs pick up definitions and store the execution information from / into a shared Redis data store. _This mode is only available when using the `redis` cache adapter._
393
402
 
394
- _You can choose between these 2 modes setting the `mode` option in the config._
403
+ _You can choose between these 2 modes setting the `mode` option in the config. An invalid combination of `cache_adaper` and `mode` will result in an Invalid Mode exception being raised._
395
404
 
396
405
  ## SDK Server Compatibility
397
406
 
@@ -38,8 +38,7 @@ module SplitIoClient
38
38
  end
39
39
  rescue StandardError => e
40
40
  SplitIoClient.configuration.logger.warn("#{e}\nURL:#{url}\ndata:#{data}\nparams:#{params}")
41
-
42
- false
41
+ raise 'Split SDK failed to connect to backend to retrieve information'
43
42
  end
44
43
 
45
44
  private
@@ -13,7 +13,7 @@ module SplitIoClient
13
13
  end
14
14
 
15
15
  @events.each_slice(SplitIoClient.configuration.events_queue_size) do |event_slice|
16
- result = post_api(
16
+ response = post_api(
17
17
  "#{SplitIoClient.configuration.events_uri}/events/bulk",
18
18
  @api_key,
19
19
  event_slice.map { |event| formatted_event(event[:e]) },
@@ -22,10 +22,12 @@ module SplitIoClient
22
22
  'SplitSDKVersion' => event_slice[0][:m][:s]
23
23
  )
24
24
 
25
- if (200..299).include? result.status
26
- SplitIoClient.configuration.logger.debug("Events reported: #{event_slice.size}") if SplitIoClient.configuration.debug_enabled
25
+ if response.success?
26
+ SplitLogger.log_if_debug("Events reported: #{event_slice.size}")
27
27
  else
28
- SplitIoClient.configuration.logger.error("Unexpected status code while posting events: #{result.status}")
28
+ SplitLogger.log_error("Unexpected status code while posting events: #{response.status}." \
29
+ " - Check your API key and base URI")
30
+ raise 'Split SDK failed to connect to backend to post events'
29
31
  end
30
32
  end
31
33
  end
@@ -13,12 +13,14 @@ module SplitIoClient
13
13
  end
14
14
 
15
15
  impressions_by_ip.each do |ip, impressions|
16
- result = post_api("#{SplitIoClient.configuration.events_uri}/testImpressions/bulk", @api_key, impressions, 'SplitSDKMachineIP' => ip)
16
+ response = post_api("#{SplitIoClient.configuration.events_uri}/testImpressions/bulk", @api_key, impressions, 'SplitSDKMachineIP' => ip)
17
17
 
18
- if (200..299).include? result.status
19
- SplitIoClient.configuration.logger.debug("Impressions reported: #{total_impressions(@impressions)}") if SplitIoClient.configuration.debug_enabled
18
+ if response.success?
19
+ SplitLogger.log_if_debug("Impressions reported: #{total_impressions(@impressions)}")
20
20
  else
21
- SplitIoClient.configuration.logger.error("Unexpected status code while posting impressions: #{result.status}")
21
+ SplitLogger.log_error("Unexpected status code while posting impressions: #{response.status}." \
22
+ " - Check your API key and base URI")
23
+ raise 'Split SDK failed to connect to backend to post impressions'
22
24
  end
23
25
  end
24
26
  end
@@ -20,9 +20,9 @@ module SplitIoClient
20
20
  @metrics_repository.latencies.each do |name, latencies|
21
21
  metrics_time = { name: name, latencies: latencies }
22
22
 
23
- result = post_api("#{SplitIoClient.configuration.events_uri}/metrics/time", @api_key, metrics_time)
23
+ response = post_api("#{SplitIoClient.configuration.events_uri}/metrics/time", @api_key, metrics_time)
24
24
 
25
- log_status(result, metrics_time.size)
25
+ log_status(response, metrics_time.size)
26
26
  end
27
27
  end
28
28
 
@@ -36,9 +36,9 @@ module SplitIoClient
36
36
  @metrics_repository.counts.each do |name, count|
37
37
  metrics_count = { name: name, delta: count }
38
38
 
39
- result = post_api("#{SplitIoClient.configuration.events_uri}/metrics/counter", @api_key, metrics_count)
39
+ response = post_api("#{SplitIoClient.configuration.events_uri}/metrics/counter", @api_key, metrics_count)
40
40
 
41
- log_status(result, metrics_count.size)
41
+ log_status(response, metrics_count.size)
42
42
  end
43
43
  end
44
44
  @metrics_repository.clear_counts
@@ -46,13 +46,13 @@ module SplitIoClient
46
46
 
47
47
  private
48
48
 
49
- def log_status(result, info_to_log)
50
- if result == false
51
- SplitIoClient.configuration.logger.error("Failed to make a http request")
52
- elsif (200..299).include? result.status
53
- SplitIoClient.configuration.logger.debug("Metric time reported: #{info_to_log}") if SplitIoClient.configuration.debug_enabled
49
+ def log_status(response, info_to_log)
50
+ if response.success?
51
+ SplitLogger.log_if_debug("Metric time reported: #{info_to_log}")
54
52
  else
55
- SplitIoClient.configuration.logger.error("Unexpected status code while posting time metrics: #{result.status}")
53
+ SplitLogger.log_error("Unexpected status code while posting time metrics: #{response.status}" \
54
+ " - Check your API key and base URI")
55
+ raise 'Split SDK failed to connect to backend to post metrics'
56
56
  end
57
57
  end
58
58
  end
@@ -51,7 +51,7 @@ module SplitIoClient
51
51
  if split[:trafficAllocation] < 100
52
52
  bucket = splitter.bucket(splitter.count_hash(key, split[:trafficAllocationSeed].to_i, legacy_algo))
53
53
 
54
- if bucket >= split[:trafficAllocation]
54
+ if bucket > split[:trafficAllocation]
55
55
  return treatment_hash(Models::Label::NOT_IN_SPLIT, split[:defaultTreatment], split[:changeNumber])
56
56
  end
57
57
  end
@@ -24,7 +24,15 @@ module SplitIoClient
24
24
  # @param sdk_blocker [SDKBlocker] SDKBlocker instance which blocks splits_repository/segments_repository
25
25
  #
26
26
  # @return [SplitIoClient] split.io client instance
27
- def initialize(api_key, splits_repository, segments_repository, impressions_repository, metrics_repository, events_repository, sdk_blocker)
27
+ def initialize(
28
+ api_key,
29
+ splits_repository,
30
+ segments_repository,
31
+ impressions_repository,
32
+ metrics_repository,
33
+ events_repository,
34
+ sdk_blocker
35
+ )
28
36
  @api_key = api_key
29
37
  @splits_repository = splits_repository
30
38
  @segments_repository = segments_repository
@@ -34,28 +42,15 @@ module SplitIoClient
34
42
  @metrics = Metrics.new(100, @metrics_repository)
35
43
  @sdk_blocker = sdk_blocker
36
44
 
37
- start_based_on_mode(SplitIoClient.configuration.mode)
45
+ start_standalone_components if SplitIoClient.configuration.mode == :standalone
38
46
  end
39
47
 
40
- def start_based_on_mode(mode)
41
- case mode
42
- when :standalone
43
- split_store
44
- segment_store
45
- metrics_sender
46
- impressions_sender
47
- events_sender
48
- when :consumer
49
- # Do nothing in background
50
- when :producer
51
- split_store
52
- segment_store
53
- impressions_sender
54
- metrics_sender
55
- events_sender
56
-
57
- sleep unless ENV['SPLITCLIENT_ENV'] == 'test'
58
- end
48
+ def start_standalone_components
49
+ split_store
50
+ segment_store
51
+ metrics_sender
52
+ impressions_sender
53
+ events_sender
59
54
  end
60
55
 
61
56
  # Starts thread which loops constantly and stores splits in the splits_repository of choice
@@ -109,7 +109,7 @@ module SplitIoClient
109
109
  #
110
110
  # The mode SDK will run
111
111
  #
112
- # @return [Symbol] One of the available SDK modes: standalone, consumer, producer
112
+ # @return [Symbol] One of the available SDK modes: standalone, consumer
113
113
  attr_accessor :mode
114
114
 
115
115
  # The read timeout for network connections in seconds.
@@ -8,6 +8,9 @@ module SplitIoClient
8
8
  def initialize(api_key, config_hash = {})
9
9
  @api_key = api_key
10
10
  SplitIoClient.configure(config_hash)
11
+
12
+ raise 'Invalid SDK mode' unless valid_mode
13
+
11
14
  @cache_adapter = SplitIoClient.configuration.cache_adapter
12
15
 
13
16
  @splits_repository = SplitsRepository.new(@cache_adapter)
@@ -33,6 +36,34 @@ module SplitIoClient
33
36
  SplitIoClient.configuration.threads.each { |_, t| t.exit }
34
37
  end
35
38
 
39
+ def valid_mode
40
+ valid_startup_mode = false
41
+ case SplitIoClient.configuration.mode
42
+ when :consumer
43
+ if SplitIoClient.configuration.cache_adapter.is_a? SplitIoClient::Cache::Adapters::RedisAdapter
44
+ valid_startup_mode = true
45
+ else
46
+ SplitIoClient.configuration.logger.error('Consumer mode cannot be used with Memory adapter. ' \
47
+ 'Use Redis adapter instead.')
48
+ end
49
+ when :standalone
50
+ if SplitIoClient.configuration.cache_adapter.is_a? SplitIoClient::Cache::Adapters::MemoryAdapter
51
+ valid_startup_mode = true
52
+ else
53
+ SplitIoClient.configuration.logger.error('Standalone mode cannot be used with Redis adapter. ' \
54
+ 'Use Memory adapter instead.')
55
+ end
56
+ when :producer
57
+ SplitIoClient.configuration.logger.error('Producer mode is no longer supported. Use Split Synchronizer. ' \
58
+ 'See: https://github.com/splitio/split-synchronizer')
59
+ else
60
+ SplitIoClient.configuration.logger.error('Invalid SDK mode selected. ' \
61
+ "Valid modes are 'standalone with memory adapter' and 'consumer with redis adapter'")
62
+ end
63
+
64
+ valid_startup_mode
65
+ end
66
+
36
67
  alias resume! start!
37
68
  end
38
69
  end
@@ -1,9 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SplitIoClient
2
4
  module Validators
3
5
  extend self
4
6
 
5
7
  def valid_get_treatment_parameters(key, split_name, matching_key, bucketing_key)
6
- valid_key?(key) && valid_split_name?(split_name) && valid_matching_key?(matching_key) && valid_bucketing_key?(bucketing_key)
8
+ valid_key?(key) &&
9
+ valid_split_name?(split_name) &&
10
+ valid_matching_key?(matching_key) &&
11
+ valid_bucketing_key?(key, bucketing_key)
7
12
  end
8
13
 
9
14
  def valid_get_treatments_parameters(split_names)
@@ -11,7 +16,10 @@ module SplitIoClient
11
16
  end
12
17
 
13
18
  def valid_track_parameters(key, traffic_type_name, event_type, value)
14
- valid_track_key?(key) && valid_traffic_type_name?(traffic_type_name) && valid_event_type?(event_type) && valid_value?(value)
19
+ valid_track_key?(key) &&
20
+ valid_traffic_type_name?(traffic_type_name) &&
21
+ valid_event_type?(event_type) &&
22
+ valid_value?(value)
15
23
  end
16
24
 
17
25
  def valid_split_parameters(split_name)
@@ -44,7 +52,7 @@ module SplitIoClient
44
52
  SplitIoClient.configuration.logger.warn("#{method}: #{key} is not of type String, converting to String")
45
53
  end
46
54
 
47
- def valid_split_name?(split_name, method=:get_treatment)
55
+ def valid_split_name?(split_name, method = :get_treatment)
48
56
  if split_name.nil?
49
57
  log_nil(:split_name, method)
50
58
  return false
@@ -55,7 +63,7 @@ module SplitIoClient
55
63
  return false
56
64
  end
57
65
 
58
- return true
66
+ true
59
67
  end
60
68
 
61
69
  def valid_key?(key)
@@ -64,7 +72,7 @@ module SplitIoClient
64
72
  return false
65
73
  end
66
74
 
67
- return true
75
+ true
68
76
  end
69
77
 
70
78
  def valid_matching_key?(matching_key)
@@ -78,16 +86,16 @@ module SplitIoClient
78
86
  return false
79
87
  end
80
88
 
81
- if matching_key.is_a? Numeric
82
- log_convert_numeric(:matching_key, :get_treatment)
83
- end
89
+ log_convert_numeric(:matching_key, :get_treatment) if matching_key.is_a? Numeric
84
90
 
85
- return true
91
+ true
86
92
  end
87
93
 
88
- def valid_bucketing_key?(bucketing_key)
94
+ def valid_bucketing_key?(key, bucketing_key)
89
95
  if bucketing_key.nil?
90
- SplitIoClient.configuration.logger.warn('get_treatment: key object should have bucketing_key set')
96
+ if key.is_a? Hash
97
+ SplitIoClient.configuration.logger.warn('get_treatment: key object should have bucketing_key set')
98
+ end
91
99
  return true
92
100
  end
93
101
 
@@ -96,11 +104,9 @@ module SplitIoClient
96
104
  return false
97
105
  end
98
106
 
99
- if bucketing_key.is_a? Numeric
100
- log_convert_numeric(:bucketing_key, :get_treatment)
101
- end
107
+ log_convert_numeric(:bucketing_key, :get_treatment) if bucketing_key.is_a? Numeric
102
108
 
103
- return true
109
+ true
104
110
  end
105
111
 
106
112
  def valid_split_names?(split_names)
@@ -114,7 +120,7 @@ module SplitIoClient
114
120
  return false
115
121
  end
116
122
 
117
- return true
123
+ true
118
124
  end
119
125
 
120
126
  def valid_track_key?(key)
@@ -128,11 +134,9 @@ module SplitIoClient
128
134
  return false
129
135
  end
130
136
 
131
- if key.is_a? Numeric
132
- log_convert_numeric(:key, :track)
133
- end
137
+ log_convert_numeric(:key, :track) if key.is_a? Numeric
134
138
 
135
- return true
139
+ true
136
140
  end
137
141
 
138
142
  def valid_event_type?(event_type)
@@ -151,7 +155,7 @@ module SplitIoClient
151
155
  return false
152
156
  end
153
157
 
154
- return true
158
+ true
155
159
  end
156
160
 
157
161
  def valid_traffic_type_name?(traffic_type_name)
@@ -170,7 +174,7 @@ module SplitIoClient
170
174
  return false
171
175
  end
172
176
 
173
- return true
177
+ true
174
178
  end
175
179
 
176
180
  def valid_value?(value)
@@ -179,7 +183,7 @@ module SplitIoClient
179
183
  return false
180
184
  end
181
185
 
182
- return true
186
+ true
183
187
  end
184
188
  end
185
189
  end
@@ -1,3 +1,3 @@
1
1
  module SplitIoClient
2
- VERSION = '5.1.3.pre.rc2'
2
+ VERSION = '5.1.3.pre.rc3'
3
3
  end
@@ -17,8 +17,6 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec|features|ext)/}) }
19
19
 
20
- spec.bindir = 'exe'
21
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
20
  spec.require_paths = ['lib']
23
21
 
24
22
  if defined?(JRUBY_VERSION)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: splitclient-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.3.pre.rc2
4
+ version: 5.1.3.pre.rc3
5
5
  platform: java
6
6
  authors:
7
7
  - Split Software
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-05 00:00:00.000000000 Z
11
+ date: 2018-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -265,8 +265,7 @@ dependencies:
265
265
  description: Ruby client for using split SDK.
266
266
  email:
267
267
  - pato@split.io
268
- executables:
269
- - splitio
268
+ executables: []
270
269
  extensions: []
271
270
  extra_rdoc_files: []
272
271
  files:
@@ -279,7 +278,6 @@ files:
279
278
  - NEWS
280
279
  - README.md
281
280
  - Rakefile
282
- - exe/splitio
283
281
  - ext/murmurhash/MurmurHash3.java
284
282
  - lib/murmurhash/base.rb
285
283
  - lib/murmurhash/murmurhash.jar
@@ -363,7 +361,6 @@ files:
363
361
  - lib/splitclient-rb/validators.rb
364
362
  - lib/splitclient-rb/version.rb
365
363
  - splitclient-rb.gemspec
366
- - splitio.yml.example
367
364
  - tasks/benchmark_get_treatment.rake
368
365
  - tasks/irb.rake
369
366
  - tasks/rspec.rake
@@ -1,96 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- lib = File.expand_path('../lib', __dir__)
5
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
-
7
- require 'optparse'
8
- require 'yaml'
9
- require_relative '../lib/splitclient-rb'
10
-
11
- # ARGV << '-h' if ARGV.empty?
12
-
13
- config_path = ''
14
- options = {}
15
- opt_parser = OptionParser.new do |opts|
16
- opts.banner = 'Usage: splitio [options]'
17
-
18
- opts.on('-cPATH', '--config=PATH', 'Set the path to splitio.yml config file') do |c|
19
- config_path = c
20
- end
21
-
22
- opts.on('--base-uri=BASE_URI', 'Set the base uri for Split SDK') do |c|
23
- options[:base_uri] = c
24
- end
25
-
26
- opts.on('--events-uri=EVENTS_URI', 'Set the events uri for Split SDK') do |c|
27
- options[:events_uri] = c
28
- end
29
-
30
- opts.on('--api-key=API_KEY', 'Set the API Key for Split SDK') do |c|
31
- options[:api_key] = c
32
- end
33
-
34
- opts.on('--read-timeout=READ_TIMEOUT', 'Read timeout in seconds') do |c|
35
- options[:read_timeout] = c
36
- end
37
-
38
- opts.on('--connection-timeout=CONNECTION_TIMEOUT', 'Connection timeout in seconds') do |c|
39
- options[:connection_timeout] = c
40
- end
41
-
42
- opts.on('--features-refresh-rate=FEATURES_REFRESH_RATE', 'Features refresh rate in seconds') do |c|
43
- options[:features_refresh_rate] = c
44
- end
45
-
46
- opts.on('--segments-refresh-rate=SEGMENTS_REFRESH_RATE', 'Segments refresh rate in seconds') do |c|
47
- options[:segments_refresh_rate] = c
48
- end
49
-
50
- opts.on('--metrics-refresh-rate=METRICS_REFRESH_RATE', 'Metrics refresh rate in seconds') do |c|
51
- options[:metrics_refresh_rate] = c
52
- end
53
-
54
- opts.on('--impressions-refresh-rate=IMPRESSIONS_REFRESH_RATE', 'Impressions refresh rate in seconds') do |c|
55
- options[:impressions_refresh_rate] = c
56
- end
57
-
58
- opts.on('--ready=SECONDS', 'Seconds to block the app until SDK is ready or false to run in non-blocking mode') do |c|
59
- options[:ready] = c
60
- end
61
-
62
- opts.on('--redis-url=REDIS_URL', 'Set base uri for Split SDK') do |c|
63
- options[:redis_url] = c
64
- end
65
-
66
- opts.on('--transport-debug', 'Enable transport debug') do
67
- options[:transport_debug_enabled] = true
68
- end
69
-
70
- opts.on('-d', '--debug', 'Enable debug mode') do
71
- options[:debug_enabled] = true
72
- end
73
-
74
- opts.on_tail('-h', '--help', 'Prints this help') do
75
- puts opts
76
- exit
77
- end
78
- end
79
-
80
- begin
81
- opt_parser.parse!(ARGV)
82
- rescue OptionParser::InvalidOption => e
83
- puts e
84
- puts opt_parser
85
- exit(1)
86
- end
87
-
88
- config = config_path != '' ? YAML.load_file(config_path) : {}
89
- config
90
- .merge!(mode: :producer, cache_adapter: :redis)
91
- .merge!(options)
92
- .merge!(api_key: ENV['API_KEY'] || config[:api_key])
93
- .merge!(base_uri: ENV['SDK_URI'] || config[:base_uri])[:events_uri] = ENV['EVENTS_URI'] || config[:events_uri]
94
- # IDENTIFY_BASE_URI
95
-
96
- SplitIoClient::SplitFactory.new(config[:api_key], config)
@@ -1,7 +0,0 @@
1
- ---
2
- :api_key: api_key
3
- :mode: :producer
4
- :cache_adapter: :redis
5
- :debug_enabled: true
6
- :transport_debug_enabled: true
7
- :impressions_refresh_rate: 30