PhoenixFlags.Config (PhoenixFlags v0.9.0)

Copy Markdown View Source

Configuration struct for a PhoenixFlags instance.

Resolved from three sources (highest priority first):

  1. Runtime options passed to start_link/1
  2. Application environment (config :my_app, MyApp.SystemConfig, ...)
  3. Compile-time options passed to use PhoenixFlags

Options

  • :otp_app (required) — the OTP application to read environment config from
  • :repo (required) — the Ecto repo used for storage
  • :name (required, set automatically) — the module that use PhoenixFlags
  • :cache_enabled — cache values in :persistent_term (default true); disable in tests for Ecto sandbox compatibility
  • :audit — record value changes in the audit table (default false)
  • :actor_fn — 1-arity function resolving the audit actor from a socket/conn
  • :encryptor — module exporting encrypt/1 and decrypt/1, required for :secret flags
  • :refresh_interval — how often (in milliseconds) the cache is reloaded from the database to heal missed cluster notifications (default 60_000); set to false to disable the periodic refresh

Summary

Functions

Creates a new config struct from the given options.

Types

t()

@type t() :: %PhoenixFlags.Config{
  actor_fn: (term() -> String.t()) | nil,
  audit: boolean(),
  cache_enabled: boolean(),
  encryptor: module() | nil,
  name: module(),
  otp_app: atom(),
  refresh_interval: pos_integer() | false,
  repo: module()
}

Functions

new!(opts)

Creates a new config struct from the given options.

Raises on missing required keys and on unknown keys — a silently ignored typo like audit_enabled: true would leave a security-relevant feature switched off.