Class: Shipeasy::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/shipeasy/config.rb', line 77

def initialize
  @base_url             = "https://api.shipeasy.ai"
  @attributes           = nil
  @init                 = true
  @poll                 = false
  @env                  = "prod"
  @disable_telemetry    = false
  @disable_internal_error_reporting = false
  @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
end

Instance Attribute Details

#api_keyObject

---- experimentation / SDK ----



23
24
25
# File 'lib/shipeasy/config.rb', line 23

def api_key
  @api_key
end

#attributesObject

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


70
71
72
# File 'lib/shipeasy/config.rb', line 70

def attributes
  @attributes
end

#base_urlObject

---- experimentation / SDK ----



23
24
25
# File 'lib/shipeasy/config.rb', line 23

def base_url
  @base_url
end

#cdn_base_urlObject

---- i18n / string manager ----



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

def cdn_base_url
  @cdn_base_url
end

#default_chunkObject

---- i18n / string manager ----



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

def default_chunk
  @default_chunk
end

#disable_internal_error_reportingObject

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.
- disable_telemetry (default false): opt out of per-eval usage telemetry.
- 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.


38
39
40
# File 'lib/shipeasy/config.rb', line 38

def disable_internal_error_reporting
  @disable_internal_error_reporting
end

#disable_telemetryObject

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.
- disable_telemetry (default false): opt out of per-eval usage telemetry.
- 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.


38
39
40
# File 'lib/shipeasy/config.rb', line 38

def disable_telemetry
  @disable_telemetry
end

#envObject

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.
- disable_telemetry (default false): opt out of per-eval usage telemetry.
- 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.


38
39
40
# File 'lib/shipeasy/config.rb', line 38

def env
  @env
end

#http_timeoutObject

---- i18n / string manager ----



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

def http_timeout
  @http_timeout
end

#initObject

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.


58
59
60
# File 'lib/shipeasy/config.rb', line 58

def init
  @init
end

#label_file_cache_ttlObject

---- i18n / string manager ----



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

def label_file_cache_ttl
  @label_file_cache_ttl
end

#loader_urlObject

---- i18n / string manager ----



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

def loader_url
  @loader_url
end

#log_levelObject

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.



48
49
50
# File 'lib/shipeasy/config.rb', line 48

def log_level
  @log_level
end

#manifest_cache_ttlObject

---- i18n / string manager ----



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

def manifest_cache_ttl
  @manifest_cache_ttl
end

#pollObject

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.


58
59
60
# File 'lib/shipeasy/config.rb', line 58

def poll
  @poll
end

#private_attributesObject

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.
- disable_telemetry (default false): opt out of per-eval usage telemetry.
- 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.


38
39
40
# File 'lib/shipeasy/config.rb', line 38

def private_attributes
  @private_attributes
end

#profileObject

---- i18n / string manager ----



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

def profile
  @profile
end

#public_keyObject

---- i18n / string manager ----



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

def public_key
  @public_key
end

#sticky_storeObject

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.
- disable_telemetry (default false): opt out of per-eval usage telemetry.
- 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.


38
39
40
# File 'lib/shipeasy/config.rb', line 38

def sticky_store
  @sticky_store
end

#telemetry_urlObject

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.
- disable_telemetry (default false): opt out of per-eval usage telemetry.
- 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.


38
39
40
# File 'lib/shipeasy/config.rb', line 38

def telemetry_url
  @telemetry_url
end