Documentation
¶
Overview ¶
Package featureflags is cloud's runtime evaluation seam over the Hanzo Insights feature-flag engine (hanzoai/insights `rust/feature-flags`, the PostHog-compatible /flags + /decide evaluator). It is NOT a second flag store: Insights OWNS flag definitions, targeting, rollout %, and the change/activity log; cloud only EVALUATES flags at runtime and surfaces the platform switches to the admin cockpit.
ONE flag engine, EVERY switch. The PLATFORM launch switches (waitlist, public signup, subsystem activation, gateway limits, network ids) are Insights feature flags; this package NAMES them (the registry below — key + category + the env var that supplies the fallback default) and reads their live value. Env is only the FALLBACK default; the Insights flag overrides. A subsystem calls Bool/Int/String and gets the hot value — a flip in the Insights flag UI takes effect within one cache TTL (default 15s) with NO redeploy.
FAIL-SAFE. When Insights is not configured (INSIGHTS_FLAGS_URL / INSIGHTS_PROJECT_ TOKEN unset) OR unreachable, evaluation degrades to the env fallback -> literal default — exactly today's behavior, zero regression. No secret is read here; the project token is injected from KMS into the process env by the deployment (the same WAITLIST_URL env convention clients/base's waitlist plugin reads), never hardcoded.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
Bool returns the live boolean value of a registered switch (Insights -> env -> default).
func Mount ¶
Mount builds the evaluation client from env (Insights base + KMS-injected project token) and installs it as the process-wide seam. It serves NO HTTP routes — it is the in-process read plane that subsystems and clients/admin consume. Disabled config is a no-op (env fallback only), never an error.
Types ¶
type BoardView ¶
type BoardView struct {
Engine string `json:"engine"`
Configured bool `json:"configured"`
ManageURL string `json:"manageUrl"`
AuditURL string `json:"auditUrl"`
Switches []SwitchView `json:"switches"`
}
BoardView is the full control-plane read board: the engine status + a deep-link to the Insights flag manager (the ONE place a switch is edited) and its activity log (the native change audit), plus every switch's live value.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client evaluates Insights feature flags over the PostHog-compatible /flags endpoint, caching the whole response for one TTL (the hot-apply bound). Reads are lock-guarded and degrade to env/default when Insights is unconfigured or unreachable.
type Def ¶
type Def struct {
Key string // the Insights feature-flag key (snake_case)
Category string // Launch | Signup | Subsystems | Gateway | Network
Label string
Desc string
Type Type
Env string // env var supplying the fallback default (may be "")
Default string // literal fallback when neither Insights nor env has a value
ReadOnly bool // surfaced read-only (boot-time activation, network ids)
}
Def is ONE platform switch: an Insights feature-flag key qualified by the metadata the cockpit shows and the env var that provides the fallback default. This table is the ONE place the platform switches are named; Insights evaluates them.
type SwitchView ¶
type SwitchView struct {
Key string `json:"key"`
Category string `json:"category"`
Label string `json:"label"`
Description string `json:"description"`
Type string `json:"type"`
Value string `json:"value"`
Source string `json:"source"`
Env string `json:"env,omitempty"`
ReadOnly bool `json:"readOnly"`
}
SwitchView is one platform switch as the admin cockpit renders it: the live value + where it came from (insights | env | default).