Shipeasy
ReferenceRuby

Configuration

```ruby config/initializers/shipeasy.rb Shipeasy.configure do |c| c.apikey = ENV.fetch("SHIPEASYSERVERKEY") c.attributes = -(u) { { "userid" = u.id, "plan"…

Generated from the SDK's own /docs/ — also served raw at https://shipeasy-ai.github.io/sdk-ruby/pages/configuration.md.

Shipeasy.configure { ... } — the once-per-process call

# config/initializers/shipeasy.rb
Shipeasy.configure do |c|
  c.api_key    = ENV.fetch("SHIPEASY_SERVER_KEY")
  c.attributes = ->(u) { { "user_id" => u.id, "plan" => u.plan } }

  # i18n view helpers only (see the i18n page):
  c.public_key = ENV.fetch("SHIPEASY_CLIENT_KEY")
  c.profile    = "default"
end
  • c.api_key — your Shipeasy server key. Authenticates flags, configs, kill switches and experiments. Never embed it in a browser.

  • c.attributes — a transform from YOUR user object to the Shipeasy attribute hash that targeting evaluates against. The default is identity, so if your user object is already that hash you can omit it:

    Shipeasy::Client.new({ "user_id" => "u_1", "plan" => "pro" }).get_flag("new_checkout")

configure is first-config-wins: the first call wires everything up; later calls are a no-op. By default it kicks off a one-shot fetch fire-and-forget, so the first Shipeasy::Client.new(user).get_flag(...) resolves against real rules.

Identity default

The attribute hash you produce is the unit of identity — supply user_id for logged-in users, or let the anon-id middleware inject anonymous_id for logged-out traffic. An explicit user_id / anonymous_id always wins.

One-shot vs background poll

  • default (c.init = true) — a one-shot fetch. Ideal for serverless / short-lived processes; no poll thread is spawned.
  • c.poll = true — 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 touch a lower-level object:
Shipeasy.configure { |c| c.api_key = ENV.fetch("SHIPEASY_SERVER_KEY"); c.poll = true }

configure options

Set any of these in the configure block:

optiondefaultwhat it does
api_key(required)Server SDK key. Authenticates evaluation + ingestion.
attributesidentityYOUR user object → the Shipeasy attribute hash.
inittrueFire the one-shot fetch fire-and-forget.
pollfalseStart the background poll (refreshes the blob over time).
base_urlhttps://edge.shipeasy.devAPI base URL for the blobs. Override for local dev / staging.
env"prod"Deployment environment tag, attached to see() events + usage telemetry.
disable_telemetryfalseOpt out of per-evaluation usage telemetry. Evaluation itself is unaffected.
telemetry_urlbuilt-inOverride the telemetry endpoint (rarely needed).
private_attributesnilAttribute keys stripped from every outbound event before it leaves the process. They still drive targeting locally. See advanced.
sticky_storenilPin a user's experiment group across re-buckets. See advanced.
public_key(none)Public client key — for the i18n view helpers / loader tag only.
profile"default"i18n locale profile read by the view helpers.

Tests and offline

For unit tests and offline evaluation, use the drop-in siblings of configureconfigure_for_testing / configure_for_offline. They take the same attributes transform (and override args), skip the api key, and let Shipeasy::Client.new(user) read without ever touching the network.

Environment variables

The SDK reads no env vars itself — you wire them through configure. Convention:

  • SHIPEASY_SERVER_KEYc.api_key
  • SHIPEASY_CLIENT_KEYc.public_key
Was this page helpful?
✎ Edit this page

On this page