Lucerna.Config (Lucerna v0.0.1-alpha.0)

Validated, immutable configuration for one Lucerna instance. Built once in Lucerna.start_link/1 — bad options raise ArgumentError at boot, never later. There is no application-env configuration by design: opts go to the supervision child spec.

Times are milliseconds (BEAM convention). Porting from the Ruby gem? Its refresh_interval: 10 (seconds) is refresh_interval: 10_000 here.

Summary

Functions

Validates opts into a config. Raises ArgumentError on any bad or unknown option.

The reporting process name for an instance name.

The store process name for an instance name.

The ETS table name for an instance name — shared with the readers.

Types

t()

@type t() :: %Lucerna.Config{
  base_url: term(),
  finch_name: term(),
  http: term(),
  identity_key: term(),
  name: term(),
  refresh_interval: term(),
  reporting_name: term(),
  request_timeout: term(),
  sdk_identity: term(),
  server_key: term(),
  sleeper: term(),
  start_finch?: term(),
  store_name: term(),
  sync_name: term(),
  table: term(),
  track_exposures: term()
}

Functions

new!(opts)

@spec new!(keyword()) :: t()

Validates opts into a config. Raises ArgumentError on any bad or unknown option.

Options:

  • :server_key — required. A server key (ck_srv_… / ck_key_…); ck_client_… browser keys are rejected.
  • :base_url — defaults to https://api.uselucerna.app.
  • :refresh_interval — runtime poll cadence in ms. Default 10000, floored at 1000.
  • :request_timeout — per-request timeout in ms. Default 5000.
  • :track_exposures — record experiment exposures on variant reads. Default true.
  • :identity_key — key for Lucerna.identify/1; defaults to :server_key.
  • :http{adapter_module, adapter_opts} implementing Lucerna.HTTP (the test seam). Defaults to the bundled Finch adapter.
  • :name — instance name (atom), default Lucerna. Everything — supervisor, ETS table, process names — derives from it, so two instances with different names coexist.

reporting_name(name)

@spec reporting_name(atom()) :: atom()

The reporting process name for an instance name.

store_name(name)

@spec store_name(atom()) :: atom()

The store process name for an instance name.

table_name(name)

@spec table_name(atom()) :: atom()

The ETS table name for an instance name — shared with the readers.