Class: Shipeasy::Configuration
- Inherits:
-
Object
- Object
- Shipeasy::Configuration
- Defined in:
- lib/shipeasy/config.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
---- experimentation / SDK ----.
-
#attributes ⇒ Object
Optional transform from YOUR user object (any shape) to the Shipeasy attribute hash every flag/experiment evaluation uses.
-
#base_url ⇒ Object
---- experimentation / SDK ----.
-
#cdn_base_url ⇒ Object
---- i18n / string manager ----.
-
#clean_backtrace ⇒ Object
Advanced
configureoptions — threaded into the global Engineconfigurebuilds, so callers never construct an Engine themselves: - env (default "prod"): deployment tag on see() events + usage telemetry. -
#default_chunk ⇒ Object
---- i18n / string manager ----.
-
#disable_internal_error_reporting ⇒ Object
Advanced
configureoptions — threaded into the global Engineconfigurebuilds, so callers never construct an Engine themselves: - env (default "prod"): deployment tag on see() events + usage telemetry. -
#disable_telemetry ⇒ Object
Advanced
configureoptions — threaded into the global Engineconfigurebuilds, so callers never construct an Engine themselves: - env (default "prod"): deployment tag on see() events + usage telemetry. -
#env ⇒ Object
Advanced
configureoptions — threaded into the global Engineconfigurebuilds, so callers never construct an Engine themselves: - env (default "prod"): deployment tag on see() events + usage telemetry. -
#http_timeout ⇒ Object
---- i18n / string manager ----.
-
#init ⇒ Object
Fetch lifecycle for the global engine
configurebuilds: - init (default true): fire a one-shot fetch fire-and-forget so the firstShipeasy::Client.new(user).get_flag(...)resolves against real rules (ideal for serverless / short-lived processes). -
#is_network_enabled ⇒ Object
Advanced
configureoptions — threaded into the global Engineconfigurebuilds, so callers never construct an Engine themselves: - env (default "prod"): deployment tag on see() events + usage telemetry. -
#label_file_cache_ttl ⇒ Object
---- i18n / string manager ----.
-
#loader_url ⇒ Object
---- i18n / string manager ----.
-
#log_level ⇒ Object
SDK-wide diagnostic verbosity for the leveled logger (Shipeasy::Logging).
-
#manifest_cache_ttl ⇒ Object
---- i18n / string manager ----.
-
#poll ⇒ Object
Fetch lifecycle for the global engine
configurebuilds: - init (default true): fire a one-shot fetch fire-and-forget so the firstShipeasy::Client.new(user).get_flag(...)resolves against real rules (ideal for serverless / short-lived processes). -
#private_attributes ⇒ Object
Advanced
configureoptions — threaded into the global Engineconfigurebuilds, so callers never construct an Engine themselves: - env (default "prod"): deployment tag on see() events + usage telemetry. -
#profile ⇒ Object
---- i18n / string manager ----.
-
#public_key ⇒ Object
---- i18n / string manager ----.
-
#render_keys_only ⇒ Object
When true,
i18n_trenders the translation KEY verbatim instead of resolving its value, so tests/snapshots assert against stable data instead of copy that changes when a translation is edited. -
#sticky_store ⇒ Object
Advanced
configureoptions — threaded into the global Engineconfigurebuilds, so callers never construct an Engine themselves: - env (default "prod"): deployment tag on see() events + usage telemetry. -
#telemetry_url ⇒ Object
Advanced
configureoptions — threaded into the global Engineconfigurebuilds, so callers never construct an Engine themselves: - env (default "prod"): deployment tag on see() events + usage telemetry.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#render_keys_only? ⇒ Boolean
Resolve the effective render_keys_only decision: an explicit true/false set in the configure block wins; otherwise default to env==test.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/shipeasy/config.rb', line 100 def initialize @base_url = "https://api.shipeasy.ai" @attributes = nil @init = true @poll = false @env = "prod" # nil ⇒ environment-derived default (see Engine / sdk/env.rb). An explicit # true/false set in the configure block always overrides. @is_network_enabled = nil @disable_telemetry = nil @disable_internal_error_reporting = false @clean_backtrace = true @telemetry_url = nil @private_attributes = nil @sticky_store = nil @log_level = :warn @profile = "default" @default_chunk = "index" @cdn_base_url = "https://cdn.i18n.shipeasy.ai" @loader_url = "https://cdn.i18n.shipeasy.ai/loader.js" @manifest_cache_ttl = 60 @label_file_cache_ttl = 3600 @http_timeout = 1 # nil ⇒ env-derived (on under RAILS_ENV/…=="test"); true/false overrides. @render_keys_only = nil end |
Instance Attribute Details
#api_key ⇒ Object
---- experimentation / SDK ----
23 24 25 |
# File 'lib/shipeasy/config.rb', line 23 def api_key @api_key end |
#attributes ⇒ Object
Optional transform from YOUR user object (any shape) to the Shipeasy attribute hash every flag/experiment evaluation uses. A callable (lambda/proc or anything responding to #call). Default = identity (the user object is assumed to already BE the attribute hash). Runs once, in the Shipeasy::Client constructor.
Shipeasy.configure do |c|
c.api_key = ENV["SHIPEASY_SERVER_KEY"]
c.attributes = ->(u) { { "user_id" => u.id, "plan" => u.plan } }
end
86 87 88 |
# File 'lib/shipeasy/config.rb', line 86 def attributes @attributes end |
#base_url ⇒ Object
---- experimentation / SDK ----
23 24 25 |
# File 'lib/shipeasy/config.rb', line 23 def base_url @base_url end |
#cdn_base_url ⇒ Object
---- i18n / string manager ----
89 90 91 |
# File 'lib/shipeasy/config.rb', line 89 def cdn_base_url @cdn_base_url end |
#clean_backtrace ⇒ Object
Advanced configure options — threaded into the global Engine configure
builds, so callers never construct an Engine themselves:
- env (default "prod"): deployment tag on see() events + usage telemetry.
- is_network_enabled (default: environment-derived): master switch for ALL
outbound requests (flag/experiment/config fetch, track, exposure logging,
see() reports, AND telemetry). Defaults ON in production and OFF in every
other environment, so a dev machine / CI run stays fully offline unless
you opt in. Explicit true/false always overrides. "Production" is decided
from SHIPEASY_ENV / RAILS_ENV / RACK_ENV / APP_ENV, then the `env` tag
(see sdk/env.rb). When off, reads answer from overrides / in-code
defaults and nothing is sent.
- disable_telemetry (default: environment-derived — off in prod, i.e.
telemetry ON in prod / OFF outside prod): opt out of per-eval usage
telemetry. Explicit true/false overrides; forced off when the network is
disabled.
- telemetry_url: override the telemetry endpoint (rarely needed).
- private_attributes: attribute keys stripped from every outbound event
before it leaves the process (they still drive targeting locally).
- sticky_store: pin a user's experiment group across re-buckets.
- disable_internal_error_reporting (default false): opt out of the
SDK's self-monitoring channel. When the SDK's last-resort guard
swallows one of its OWN internal errors it normally ships a structured
see event to Shipeasy's own project (NOT yours) so the SDK team can
track SDK bugs; set true to disable that entirely.
- clean_backtrace (default true): pass see() error backtraces through the
host framework's own backtrace cleaner so reports carry only your
application frames (gem/framework noise stripped). We do not invent the
filtering rules — this leverages `Rails.backtrace_cleaner` and is a
no-op outside Rails. Set false to always report the raw backtrace.
54 55 56 |
# File 'lib/shipeasy/config.rb', line 54 def clean_backtrace @clean_backtrace end |
#default_chunk ⇒ Object
---- i18n / string manager ----
89 90 91 |
# File 'lib/shipeasy/config.rb', line 89 def default_chunk @default_chunk end |
#disable_internal_error_reporting ⇒ Object
Advanced configure options — threaded into the global Engine configure
builds, so callers never construct an Engine themselves:
- env (default "prod"): deployment tag on see() events + usage telemetry.
- is_network_enabled (default: environment-derived): master switch for ALL
outbound requests (flag/experiment/config fetch, track, exposure logging,
see() reports, AND telemetry). Defaults ON in production and OFF in every
other environment, so a dev machine / CI run stays fully offline unless
you opt in. Explicit true/false always overrides. "Production" is decided
from SHIPEASY_ENV / RAILS_ENV / RACK_ENV / APP_ENV, then the `env` tag
(see sdk/env.rb). When off, reads answer from overrides / in-code
defaults and nothing is sent.
- disable_telemetry (default: environment-derived — off in prod, i.e.
telemetry ON in prod / OFF outside prod): opt out of per-eval usage
telemetry. Explicit true/false overrides; forced off when the network is
disabled.
- telemetry_url: override the telemetry endpoint (rarely needed).
- private_attributes: attribute keys stripped from every outbound event
before it leaves the process (they still drive targeting locally).
- sticky_store: pin a user's experiment group across re-buckets.
- disable_internal_error_reporting (default false): opt out of the
SDK's self-monitoring channel. When the SDK's last-resort guard
swallows one of its OWN internal errors it normally ships a structured
see event to Shipeasy's own project (NOT yours) so the SDK team can
track SDK bugs; set true to disable that entirely.
- clean_backtrace (default true): pass see() error backtraces through the
host framework's own backtrace cleaner so reports carry only your
application frames (gem/framework noise stripped). We do not invent the
filtering rules — this leverages `Rails.backtrace_cleaner` and is a
no-op outside Rails. Set false to always report the raw backtrace.
54 55 56 |
# File 'lib/shipeasy/config.rb', line 54 def disable_internal_error_reporting @disable_internal_error_reporting end |
#disable_telemetry ⇒ Object
Advanced configure options — threaded into the global Engine configure
builds, so callers never construct an Engine themselves:
- env (default "prod"): deployment tag on see() events + usage telemetry.
- is_network_enabled (default: environment-derived): master switch for ALL
outbound requests (flag/experiment/config fetch, track, exposure logging,
see() reports, AND telemetry). Defaults ON in production and OFF in every
other environment, so a dev machine / CI run stays fully offline unless
you opt in. Explicit true/false always overrides. "Production" is decided
from SHIPEASY_ENV / RAILS_ENV / RACK_ENV / APP_ENV, then the `env` tag
(see sdk/env.rb). When off, reads answer from overrides / in-code
defaults and nothing is sent.
- disable_telemetry (default: environment-derived — off in prod, i.e.
telemetry ON in prod / OFF outside prod): opt out of per-eval usage
telemetry. Explicit true/false overrides; forced off when the network is
disabled.
- telemetry_url: override the telemetry endpoint (rarely needed).
- private_attributes: attribute keys stripped from every outbound event
before it leaves the process (they still drive targeting locally).
- sticky_store: pin a user's experiment group across re-buckets.
- disable_internal_error_reporting (default false): opt out of the
SDK's self-monitoring channel. When the SDK's last-resort guard
swallows one of its OWN internal errors it normally ships a structured
see event to Shipeasy's own project (NOT yours) so the SDK team can
track SDK bugs; set true to disable that entirely.
- clean_backtrace (default true): pass see() error backtraces through the
host framework's own backtrace cleaner so reports carry only your
application frames (gem/framework noise stripped). We do not invent the
filtering rules — this leverages `Rails.backtrace_cleaner` and is a
no-op outside Rails. Set false to always report the raw backtrace.
54 55 56 |
# File 'lib/shipeasy/config.rb', line 54 def disable_telemetry @disable_telemetry end |
#env ⇒ Object
Advanced configure options — threaded into the global Engine configure
builds, so callers never construct an Engine themselves:
- env (default "prod"): deployment tag on see() events + usage telemetry.
- is_network_enabled (default: environment-derived): master switch for ALL
outbound requests (flag/experiment/config fetch, track, exposure logging,
see() reports, AND telemetry). Defaults ON in production and OFF in every
other environment, so a dev machine / CI run stays fully offline unless
you opt in. Explicit true/false always overrides. "Production" is decided
from SHIPEASY_ENV / RAILS_ENV / RACK_ENV / APP_ENV, then the `env` tag
(see sdk/env.rb). When off, reads answer from overrides / in-code
defaults and nothing is sent.
- disable_telemetry (default: environment-derived — off in prod, i.e.
telemetry ON in prod / OFF outside prod): opt out of per-eval usage
telemetry. Explicit true/false overrides; forced off when the network is
disabled.
- telemetry_url: override the telemetry endpoint (rarely needed).
- private_attributes: attribute keys stripped from every outbound event
before it leaves the process (they still drive targeting locally).
- sticky_store: pin a user's experiment group across re-buckets.
- disable_internal_error_reporting (default false): opt out of the
SDK's self-monitoring channel. When the SDK's last-resort guard
swallows one of its OWN internal errors it normally ships a structured
see event to Shipeasy's own project (NOT yours) so the SDK team can
track SDK bugs; set true to disable that entirely.
- clean_backtrace (default true): pass see() error backtraces through the
host framework's own backtrace cleaner so reports carry only your
application frames (gem/framework noise stripped). We do not invent the
filtering rules — this leverages `Rails.backtrace_cleaner` and is a
no-op outside Rails. Set false to always report the raw backtrace.
54 55 56 |
# File 'lib/shipeasy/config.rb', line 54 def env @env end |
#http_timeout ⇒ Object
---- i18n / string manager ----
89 90 91 |
# File 'lib/shipeasy/config.rb', line 89 def http_timeout @http_timeout end |
#init ⇒ Object
Fetch lifecycle for the global engine configure builds:
- init (default true): fire a one-shot fetch fire-and-forget so the first
`Shipeasy::Client.new(user).get_flag(...)` resolves against real rules
(ideal for serverless / short-lived processes).
- poll (default false): start the background poll (initial fetch +
periodic refresh) for a long-running server, so flags stay fresh
without a redeploy. Configuration owns the lifecycle — you never call
`engine.init` yourself.
74 75 76 |
# File 'lib/shipeasy/config.rb', line 74 def init @init end |
#is_network_enabled ⇒ Object
Advanced configure options — threaded into the global Engine configure
builds, so callers never construct an Engine themselves:
- env (default "prod"): deployment tag on see() events + usage telemetry.
- is_network_enabled (default: environment-derived): master switch for ALL
outbound requests (flag/experiment/config fetch, track, exposure logging,
see() reports, AND telemetry). Defaults ON in production and OFF in every
other environment, so a dev machine / CI run stays fully offline unless
you opt in. Explicit true/false always overrides. "Production" is decided
from SHIPEASY_ENV / RAILS_ENV / RACK_ENV / APP_ENV, then the `env` tag
(see sdk/env.rb). When off, reads answer from overrides / in-code
defaults and nothing is sent.
- disable_telemetry (default: environment-derived — off in prod, i.e.
telemetry ON in prod / OFF outside prod): opt out of per-eval usage
telemetry. Explicit true/false overrides; forced off when the network is
disabled.
- telemetry_url: override the telemetry endpoint (rarely needed).
- private_attributes: attribute keys stripped from every outbound event
before it leaves the process (they still drive targeting locally).
- sticky_store: pin a user's experiment group across re-buckets.
- disable_internal_error_reporting (default false): opt out of the
SDK's self-monitoring channel. When the SDK's last-resort guard
swallows one of its OWN internal errors it normally ships a structured
see event to Shipeasy's own project (NOT yours) so the SDK team can
track SDK bugs; set true to disable that entirely.
- clean_backtrace (default true): pass see() error backtraces through the
host framework's own backtrace cleaner so reports carry only your
application frames (gem/framework noise stripped). We do not invent the
filtering rules — this leverages `Rails.backtrace_cleaner` and is a
no-op outside Rails. Set false to always report the raw backtrace.
54 55 56 |
# File 'lib/shipeasy/config.rb', line 54 def is_network_enabled @is_network_enabled end |
#label_file_cache_ttl ⇒ Object
---- i18n / string manager ----
89 90 91 |
# File 'lib/shipeasy/config.rb', line 89 def label_file_cache_ttl @label_file_cache_ttl end |
#loader_url ⇒ Object
---- i18n / string manager ----
89 90 91 |
# File 'lib/shipeasy/config.rb', line 89 def loader_url @loader_url end |
#log_level ⇒ Object
SDK-wide diagnostic verbosity for the leveled logger (Shipeasy::Logging). One of :silent, :error, :warn (default), :info, :debug (strings accepted and downcased; unknown falls back to :warn). Controls the stderr output of every caught-error diagnostic the SDK emits — the public runtime reads (get_flag/get_config/…) never raise, so this only tunes how loud they are about a recovered failure. Threaded into the global Engine by configure.
64 65 66 |
# File 'lib/shipeasy/config.rb', line 64 def log_level @log_level end |
#manifest_cache_ttl ⇒ Object
---- i18n / string manager ----
89 90 91 |
# File 'lib/shipeasy/config.rb', line 89 def manifest_cache_ttl @manifest_cache_ttl end |
#poll ⇒ Object
Fetch lifecycle for the global engine configure builds:
- init (default true): fire a one-shot fetch fire-and-forget so the first
`Shipeasy::Client.new(user).get_flag(...)` resolves against real rules
(ideal for serverless / short-lived processes).
- poll (default false): start the background poll (initial fetch +
periodic refresh) for a long-running server, so flags stay fresh
without a redeploy. Configuration owns the lifecycle — you never call
`engine.init` yourself.
74 75 76 |
# File 'lib/shipeasy/config.rb', line 74 def poll @poll end |
#private_attributes ⇒ Object
Advanced configure options — threaded into the global Engine configure
builds, so callers never construct an Engine themselves:
- env (default "prod"): deployment tag on see() events + usage telemetry.
- is_network_enabled (default: environment-derived): master switch for ALL
outbound requests (flag/experiment/config fetch, track, exposure logging,
see() reports, AND telemetry). Defaults ON in production and OFF in every
other environment, so a dev machine / CI run stays fully offline unless
you opt in. Explicit true/false always overrides. "Production" is decided
from SHIPEASY_ENV / RAILS_ENV / RACK_ENV / APP_ENV, then the `env` tag
(see sdk/env.rb). When off, reads answer from overrides / in-code
defaults and nothing is sent.
- disable_telemetry (default: environment-derived — off in prod, i.e.
telemetry ON in prod / OFF outside prod): opt out of per-eval usage
telemetry. Explicit true/false overrides; forced off when the network is
disabled.
- telemetry_url: override the telemetry endpoint (rarely needed).
- private_attributes: attribute keys stripped from every outbound event
before it leaves the process (they still drive targeting locally).
- sticky_store: pin a user's experiment group across re-buckets.
- disable_internal_error_reporting (default false): opt out of the
SDK's self-monitoring channel. When the SDK's last-resort guard
swallows one of its OWN internal errors it normally ships a structured
see event to Shipeasy's own project (NOT yours) so the SDK team can
track SDK bugs; set true to disable that entirely.
- clean_backtrace (default true): pass see() error backtraces through the
host framework's own backtrace cleaner so reports carry only your
application frames (gem/framework noise stripped). We do not invent the
filtering rules — this leverages `Rails.backtrace_cleaner` and is a
no-op outside Rails. Set false to always report the raw backtrace.
54 55 56 |
# File 'lib/shipeasy/config.rb', line 54 def private_attributes @private_attributes end |
#profile ⇒ Object
---- i18n / string manager ----
89 90 91 |
# File 'lib/shipeasy/config.rb', line 89 def profile @profile end |
#public_key ⇒ Object
---- i18n / string manager ----
89 90 91 |
# File 'lib/shipeasy/config.rb', line 89 def public_key @public_key end |
#render_keys_only ⇒ Object
When true, i18n_t renders the translation KEY verbatim instead of
resolving its value, so tests/snapshots assert against stable data instead
of copy that changes when a translation is edited. nil (default) ⇒
env-derived: on when the native env is "test" (RAILS_ENV / RACK_ENV /
SHIPEASY_ENV / APP_ENV), off otherwise. Set true/false to override.
98 99 100 |
# File 'lib/shipeasy/config.rb', line 98 def render_keys_only @render_keys_only end |
#sticky_store ⇒ Object
Advanced configure options — threaded into the global Engine configure
builds, so callers never construct an Engine themselves:
- env (default "prod"): deployment tag on see() events + usage telemetry.
- is_network_enabled (default: environment-derived): master switch for ALL
outbound requests (flag/experiment/config fetch, track, exposure logging,
see() reports, AND telemetry). Defaults ON in production and OFF in every
other environment, so a dev machine / CI run stays fully offline unless
you opt in. Explicit true/false always overrides. "Production" is decided
from SHIPEASY_ENV / RAILS_ENV / RACK_ENV / APP_ENV, then the `env` tag
(see sdk/env.rb). When off, reads answer from overrides / in-code
defaults and nothing is sent.
- disable_telemetry (default: environment-derived — off in prod, i.e.
telemetry ON in prod / OFF outside prod): opt out of per-eval usage
telemetry. Explicit true/false overrides; forced off when the network is
disabled.
- telemetry_url: override the telemetry endpoint (rarely needed).
- private_attributes: attribute keys stripped from every outbound event
before it leaves the process (they still drive targeting locally).
- sticky_store: pin a user's experiment group across re-buckets.
- disable_internal_error_reporting (default false): opt out of the
SDK's self-monitoring channel. When the SDK's last-resort guard
swallows one of its OWN internal errors it normally ships a structured
see event to Shipeasy's own project (NOT yours) so the SDK team can
track SDK bugs; set true to disable that entirely.
- clean_backtrace (default true): pass see() error backtraces through the
host framework's own backtrace cleaner so reports carry only your
application frames (gem/framework noise stripped). We do not invent the
filtering rules — this leverages `Rails.backtrace_cleaner` and is a
no-op outside Rails. Set false to always report the raw backtrace.
54 55 56 |
# File 'lib/shipeasy/config.rb', line 54 def sticky_store @sticky_store end |
#telemetry_url ⇒ Object
Advanced configure options — threaded into the global Engine configure
builds, so callers never construct an Engine themselves:
- env (default "prod"): deployment tag on see() events + usage telemetry.
- is_network_enabled (default: environment-derived): master switch for ALL
outbound requests (flag/experiment/config fetch, track, exposure logging,
see() reports, AND telemetry). Defaults ON in production and OFF in every
other environment, so a dev machine / CI run stays fully offline unless
you opt in. Explicit true/false always overrides. "Production" is decided
from SHIPEASY_ENV / RAILS_ENV / RACK_ENV / APP_ENV, then the `env` tag
(see sdk/env.rb). When off, reads answer from overrides / in-code
defaults and nothing is sent.
- disable_telemetry (default: environment-derived — off in prod, i.e.
telemetry ON in prod / OFF outside prod): opt out of per-eval usage
telemetry. Explicit true/false overrides; forced off when the network is
disabled.
- telemetry_url: override the telemetry endpoint (rarely needed).
- private_attributes: attribute keys stripped from every outbound event
before it leaves the process (they still drive targeting locally).
- sticky_store: pin a user's experiment group across re-buckets.
- disable_internal_error_reporting (default false): opt out of the
SDK's self-monitoring channel. When the SDK's last-resort guard
swallows one of its OWN internal errors it normally ships a structured
see event to Shipeasy's own project (NOT yours) so the SDK team can
track SDK bugs; set true to disable that entirely.
- clean_backtrace (default true): pass see() error backtraces through the
host framework's own backtrace cleaner so reports carry only your
application frames (gem/framework noise stripped). We do not invent the
filtering rules — this leverages `Rails.backtrace_cleaner` and is a
no-op outside Rails. Set false to always report the raw backtrace.
54 55 56 |
# File 'lib/shipeasy/config.rb', line 54 def telemetry_url @telemetry_url end |
Instance Method Details
#render_keys_only? ⇒ Boolean
Resolve the effective render_keys_only decision: an explicit true/false set in the configure block wins; otherwise default to env==test.
130 131 132 133 134 |
# File 'lib/shipeasy/config.rb', line 130 def render_keys_only? return @render_keys_only unless @render_keys_only.nil? Shipeasy::SDK::Env.is_test_env end |