Class: Quonfig::Options
- Inherits:
-
Object
- Object
- Quonfig::Options
- Defined in:
- lib/quonfig/options.rb
Overview
Options passed to Quonfig::Client at construction time.
Defined Under Namespace
Modules: ON_INITIALIZATION_FAILURE, ON_NO_DEFAULT
Constant Summary collapse
- DEFAULT_MAX_PATHS =
1_000- DEFAULT_MAX_KEYS =
100_000- DEFAULT_MAX_EXAMPLE_CONTEXTS =
100_000- DEFAULT_MAX_EVAL_SUMMARIES =
100_000- DEFAULT_API_URLS =
[ 'https://primary.quonfig.com', ].freeze
Instance Attribute Summary collapse
-
#api_urls ⇒ Object
readonly
Returns the value of attribute api_urls.
-
#collect_sync_interval ⇒ Object
readonly
Returns the value of attribute collect_sync_interval.
-
#config_api_urls ⇒ Object
readonly
Returns the value of attribute config_api_urls.
-
#datadir ⇒ Object
readonly
Returns the value of attribute datadir.
-
#enable_polling ⇒ Object
readonly
Returns the value of attribute enable_polling.
-
#enable_sse ⇒ Object
readonly
Returns the value of attribute enable_sse.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#global_context ⇒ Object
readonly
Returns the value of attribute global_context.
-
#initialization_timeout_sec ⇒ Object
readonly
Returns the value of attribute initialization_timeout_sec.
-
#is_fork ⇒ Object
Returns the value of attribute is_fork.
-
#on_init_failure ⇒ Object
readonly
Returns the value of attribute on_init_failure.
-
#on_no_default ⇒ Object
readonly
Returns the value of attribute on_no_default.
-
#sdk_key ⇒ Object
readonly
Returns the value of attribute sdk_key.
-
#sse_api_urls ⇒ Object
readonly
Returns the value of attribute sse_api_urls.
-
#telemetry_destination ⇒ Object
readonly
Returns the value of attribute telemetry_destination.
Class Method Summary collapse
-
.derive_stream_url(api_url) ⇒ Object
Derive the SSE stream URL for a given API URL by prepending ‘stream.` to the hostname.
Instance Method Summary collapse
- #collect_max_evaluation_summaries ⇒ Object
- #collect_max_example_contexts ⇒ Object
- #collect_max_paths ⇒ Object
- #collect_max_shapes ⇒ Object
- #datadir? ⇒ Boolean
- #for_fork ⇒ Object
-
#initialize(options = {}) ⇒ Options
constructor
A new instance of Options.
-
#local_only? ⇒ Boolean
In datadir mode the SDK evaluates config from a local workspace and does not connect to the delivery service.
- #sdk_key_id ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Options
Returns a new instance of Options.
125 126 127 |
# File 'lib/quonfig/options.rb', line 125 def initialize( = {}) init(**) end |
Instance Attribute Details
#api_urls ⇒ Object (readonly)
Returns the value of attribute api_urls.
10 11 12 |
# File 'lib/quonfig/options.rb', line 10 def api_urls @api_urls end |
#collect_sync_interval ⇒ Object (readonly)
Returns the value of attribute collect_sync_interval.
17 18 19 |
# File 'lib/quonfig/options.rb', line 17 def collect_sync_interval @collect_sync_interval end |
#config_api_urls ⇒ Object (readonly)
Returns the value of attribute config_api_urls.
13 14 15 |
# File 'lib/quonfig/options.rb', line 13 def config_api_urls @config_api_urls end |
#datadir ⇒ Object (readonly)
Returns the value of attribute datadir.
18 19 20 |
# File 'lib/quonfig/options.rb', line 18 def datadir @datadir end |
#enable_polling ⇒ Object (readonly)
Returns the value of attribute enable_polling.
20 21 22 |
# File 'lib/quonfig/options.rb', line 20 def enable_polling @enable_polling end |
#enable_sse ⇒ Object (readonly)
Returns the value of attribute enable_sse.
19 20 21 |
# File 'lib/quonfig/options.rb', line 19 def enable_sse @enable_sse end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
9 10 11 |
# File 'lib/quonfig/options.rb', line 9 def environment @environment end |
#global_context ⇒ Object (readonly)
Returns the value of attribute global_context.
21 22 23 |
# File 'lib/quonfig/options.rb', line 21 def global_context @global_context end |
#initialization_timeout_sec ⇒ Object (readonly)
Returns the value of attribute initialization_timeout_sec.
15 16 17 |
# File 'lib/quonfig/options.rb', line 15 def initialization_timeout_sec @initialization_timeout_sec end |
#is_fork ⇒ Object
Returns the value of attribute is_fork.
22 23 24 |
# File 'lib/quonfig/options.rb', line 22 def is_fork @is_fork end |
#on_init_failure ⇒ Object (readonly)
Returns the value of attribute on_init_failure.
16 17 18 |
# File 'lib/quonfig/options.rb', line 16 def on_init_failure @on_init_failure end |
#on_no_default ⇒ Object (readonly)
Returns the value of attribute on_no_default.
14 15 16 |
# File 'lib/quonfig/options.rb', line 14 def on_no_default @on_no_default end |
#sdk_key ⇒ Object (readonly)
Returns the value of attribute sdk_key.
8 9 10 |
# File 'lib/quonfig/options.rb', line 8 def sdk_key @sdk_key end |
#sse_api_urls ⇒ Object (readonly)
Returns the value of attribute sse_api_urls.
11 12 13 |
# File 'lib/quonfig/options.rb', line 11 def sse_api_urls @sse_api_urls end |
#telemetry_destination ⇒ Object (readonly)
Returns the value of attribute telemetry_destination.
12 13 14 |
# File 'lib/quonfig/options.rb', line 12 def telemetry_destination @telemetry_destination end |
Class Method Details
.derive_stream_url(api_url) ⇒ Object
Derive the SSE stream URL for a given API URL by prepending ‘stream.` to the hostname. Preserves scheme, port, and path.
derive_stream_url('https://primary.quonfig.com')
# => 'https://stream.primary.quonfig.com'
derive_stream_url('http://localhost:6550')
# => 'http://stream.localhost:6550'
50 51 52 53 54 |
# File 'lib/quonfig/options.rb', line 50 def self.derive_stream_url(api_url) uri = URI.parse(api_url) uri.host = "stream.#{uri.host}" if uri.host uri.to_s end |
Instance Method Details
#collect_max_evaluation_summaries ⇒ Object
157 158 159 160 161 |
# File 'lib/quonfig/options.rb', line 157 def collect_max_evaluation_summaries return 0 unless telemetry_allowed?(@collect_evaluation_summaries) @collect_max_evaluation_summaries end |
#collect_max_example_contexts ⇒ Object
151 152 153 154 155 |
# File 'lib/quonfig/options.rb', line 151 def collect_max_example_contexts return 0 unless telemetry_allowed?(@collect_example_contexts) @collect_max_example_contexts end |
#collect_max_paths ⇒ Object
139 140 141 142 143 |
# File 'lib/quonfig/options.rb', line 139 def collect_max_paths return 0 unless telemetry_allowed?(true) @collect_max_paths end |
#collect_max_shapes ⇒ Object
145 146 147 148 149 |
# File 'lib/quonfig/options.rb', line 145 def collect_max_shapes return 0 unless telemetry_allowed?(@collect_shapes) @collect_max_shapes end |
#datadir? ⇒ Boolean
135 136 137 |
# File 'lib/quonfig/options.rb', line 135 def datadir? !@datadir.nil? end |
#for_fork ⇒ Object
167 168 169 170 171 |
# File 'lib/quonfig/options.rb', line 167 def for_fork clone = self.clone clone.is_fork = true clone end |
#local_only? ⇒ Boolean
In datadir mode the SDK evaluates config from a local workspace and does not connect to the delivery service.
131 132 133 |
# File 'lib/quonfig/options.rb', line 131 def local_only? !@datadir.nil? end |
#sdk_key_id ⇒ Object
163 164 165 |
# File 'lib/quonfig/options.rb', line 163 def sdk_key_id @sdk_key&.split('-')&.first end |