Documentation
¶
Overview ¶
Package settings is the per-org, per-product configuration plane for the unified Hanzo Cloud binary: the /v1/settings/:product surface behind every product's detail view in console.hanzo.ai (#59). It lets an org read and edit a product's configuration, backed by a durable per-tenant SQLite store with KMS custody for any secret-typed field.
ONE settings engine, EVERY product. The console drives all products' Settings tab through this single surface (product id → :product). There is no per-product bespoke server code — a product is just an (org, product) key.
Surface (all org-scoped; /v1 only):
GET /v1/settings/:product org config (read, secrets masked) -> settingsView PUT /v1/settings/:product org config (write) -> settingsView
TENANT ISOLATION is enforced SERVER-SIDE on every request. The org is principal.Org(c) — the value SanitizeIdentity minted from the VALIDATED bearer owner (HIP-0026) — and is NEVER read from a query param, body, or client header. It is the mandatory predicate on every store statement. The client chooses a PRODUCT (validated against a slug shape); it never supplies the org.
SECRET CUSTODY. A secret field's VALUE lives ONLY in KMS at orgs/{org}/settings/{product}/{key}; the store keeps only the non-secret JSON plus the list of secret key NAMES (so the read path knows which fields are set-but- masked). A plaintext secret can never reach SQLite — a secret write routes to KMS or fails closed (503).
This surface was previously mounted by clients/observe alongside the o11y read paths; those reads now live in clients/o11y (the embedded runtime). Settings is NOT observability — it is console product-detail config — so it is its own plane here, its behavior preserved verbatim from the observe original.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Settings ¶ added in v1.786.145
type Settings struct {
Org string
Product string
Config string // opaque non-secret JSON object, stored verbatim (bounded at the edge)
SecretKeys []string // names of secret fields (values in KMS, never here)
CreatedAt int64
UpdatedAt int64
}
Settings is the persisted per-(org,product) config record. Config is the non-secret JSON document; SecretKeys names the fields whose values live in KMS.
type SettingsStore ¶ added in v1.786.145
type SettingsStore struct {
// contains filtered or unexported fields
}
SettingsStore is the settings metastore over one SQLite file ({DataDir}/settings.db). Tenancy is the (org, product) key.
func (*SettingsStore) Close ¶ added in v1.786.145
func (s *SettingsStore) Close() error
Close closes the underlying database.
func (*SettingsStore) Get ¶ added in v1.786.145
Get returns the persisted settings for (org, product), or errNotFound when the org has never written config for that product (the caller then serves the product defaults merged with an empty override).