Documentation
¶
Overview ¶
Package settings is the typed-sectioned config layer.
Each known section is a Go type with a Validate() method, registered statically in this package's init via Register(). The DB stores one row per section in the `settings` table; the value is opaque JSONB, the typed struct enforces shape on read and write.
Adding a new section: create <section>.go with the typed struct, implement Validate() error, call Register() from its init().
Hot-path consumers read from the in-memory Cache populated by the catalog reconciler; the Store is admin-plane only.
Index ¶
- Constants
- Variables
- func AdminOnly(section string) bool
- func Governs(r Reader, op Op, kind, ownerKind string, admin bool) error
- func Names() []string
- func OAuthSection(provider string) string
- func Register(sec Section)
- func RegisterOAuthProvider(provider string)
- func SecretRefs(v any) map[string]secret.Ref
- func SeedDir(ctx context.Context, store *Store, dir string) ([]string, error)
- func SetLicenseGate(c license.Checker)
- func SetSchemaRef(name, ref string)
- type Accounts
- type Audit
- type AuthOIDC
- type AuthSCIM
- type AuthTokens
- type CatalogSource
- type Governance
- type Inference
- type License
- type MutationError
- type OAuthProvider
- type OTLPReceiver
- type Op
- type Parsing
- type PayloadClickHouse
- type PayloadFile
- type PayloadLogging
- type PayloadS3
- type ProxyMode
- type Reader
- type Row
- type Section
- type SectionName
- type Store
- type UsageClickHouse
- type UsageFile
- type UsageLogging
Constants ¶
const ( PersonalAccountsOn = "on" PersonalAccountsOff = "off" )
Personal-account switch values, shared by the section, a group and a user.
const ( SectionGovernanceProvider = "governance:provider" SectionGovernanceHost = "governance:host" SectionGovernanceModel = "governance:model" SectionGovernancePolicy = "governance:policy" )
Governance section keys. Colon-namespaced so they double as future RBAC permission targets (governance:<resource>). Only the catalog-managed kinds need a section; purely user-owned kinds fall through to the user tier in Governs.
const AuthOIDCSection = "auth:oidc"
AuthOIDCSection is the section name.
const AuthSCIMSection = "auth:scim"
AuthSCIMSection is the section name.
const AuthTokensSection = "auth:tokens"
AuthTokensSection is the section name.
const DefaultKeyRotateMaxGrace = 24 * 60 * 60
DefaultKeyRotateMaxGrace is the cap applied when the section leaves KeyRotateMaxGrace unset.
const DefaultPayloadRetentionDays = 30
DefaultPayloadRetentionDays applies when payload-logging sets no retentionDays.
const DefaultVerifyCacheSize = 10000
DefaultVerifyCacheSize is the verified-claims cache bound when the section names none.
const OAuthSectionPrefix = "oauth:"
OAuthSectionPrefix namespaces per-provider OAuth sections (oauth:anthropic, oauth:openai, …), mirroring the governance:<kind> convention.
const SectionAccounts = "accounts"
SectionAccounts is the section key for deployment-wide account settings.
const SectionAudit = "audit"
SectionAudit is the section key for the admin audit log's retention window. Read live by the audit emitter's hourly prune, so a change takes effect without a restart.
const SectionCatalogSource = "catalog-source"
SectionCatalogSource is the section key for the catalog-source marker — the record of which public-catalog version the DB's template rows were last seeded from.
const SectionInference = "inference"
SectionInference is the section key for normal-mode inference behavior knobs — settings that affect /v1/* traffic served via an authenticated Key. Distinct from proxy-mode (BYO-creds), which has its own section.
const SectionLicense = "license"
SectionLicense holds the inline license value pasted through the admin UI, so a deployment can install a key without a redeploy. The RELAY_LICENSE_FILE / RELAY_LICENSE environment still wins when set.
const SectionOTLPReceiver = "otlp-receiver"
SectionOTLPReceiver is the section key for the OpenTelemetry receiver on the inference listener.
const SectionParsing = "parsing"
SectionParsing is the section key for request-parsing behavior knobs — how much structure the relay extracts from inbound request bodies before dispatch. Applies across flows (authenticated /v1/* and proxy-mode), so it is its own section rather than living under inference or proxy-mode.
const SectionPayloadLogging = "payload-logging"
SectionPayloadLogging is the section key for the request/response body capture observer's runtime config. Mutable at runtime via the settings API — the payload observer reconciles the live value and hot-swaps its sink (toggle, backend, bucket, credentials) without a restart.
const SectionProxyMode = "proxy-mode"
SectionProxyMode is the section key for the proxy-mode settings — the singleton that gates anonymous-key (BYO upstream creds) inference traffic served by the future app/proxy flow.
const SectionUsageLogging = "usage-logging"
SectionUsageLogging is the section key for the log (usage) event sink's backend selection. The log observer reconciles the live value and hot-swaps its sink + reader without a restart. Mirrors payload-logging, minus the per-request opt-in (logging is constant — every request).
Connection-level config (DSNs) stays bootstrap-tier (boot env), the same way the PG DSN does: you need a connection before you can read settings. Only the backend selection + safe per-backend knobs live here.
Variables ¶
var ErrSecretRefNotAllowed = errors.New("secret reference not allowed")
ErrSecretRefNotAllowed marks a section value that would resolve a secret outside the section's scope or send one without TLS.
var GovernanceSections = []string{ SectionGovernanceProvider, SectionGovernanceHost, SectionGovernanceModel, SectionGovernancePolicy, }
GovernanceSections lists every registered governance:<kind> section key.
Functions ¶
func AdminOnly ¶ added in v0.10.1
AdminOnly reports whether writing section requires an admin caller.
func Governs ¶
Governs decides whether op may be applied to a row of the given kind with the given ownerKind. It is the single source of truth for mutation governance; httpapi calls it and maps a non-nil result to 403.
Owner tiers are hardcoded invariants (not operator-toggleable):
- system → edited or deleted only by an admin (the admin role or the admin token). A delete is still refused while anything references the row; that check lives with the references, not here.
- user / team / project → always allowed (the row belongs to a tenant, not to the catalog). RBAC will later add an owner match here.
- else (provider/host-owned, i.e. catalog-managed) → consult the kind's governance:<kind> section; absent or unregistered ⇒ the safe default (edit allowed, delete denied).
admin reports whether the caller holds the admin identity (authz.IsAdmin); it only widens the system tier.
func Names ¶
func Names() []string
Names returns all registered section names in lexical order. Used by the list endpoint and the cache to enumerate sections.
func OAuthSection ¶ added in v0.4.2
OAuthSection returns the settings section name for a provider.
func Register ¶
func Register(sec Section)
Register adds sec to the section registry. Called from each section's init(). Panics on duplicate registration — the typo would otherwise be silent.
func RegisterOAuthProvider ¶ added in v0.4.2
func RegisterOAuthProvider(provider string)
RegisterOAuthProvider registers the oauth:<provider> settings section so its config can be seeded and edited via the settings API. Call once per provider (e.g. from a vendor wiring file in the composition root) before settings are seeded or served. Panics on duplicate registration.
func SecretRefs ¶ added in v0.10.1
SecretRefs returns the secret refs a section value holds, keyed by field path, so deleting a stored secret can tell whether a section still names it. A section with a secret.Ref field must be listed here.
func SeedDir ¶
SeedDir loads settings from manifest YAML in dir and upserts each section that has NO existing DB row — **seed-if-absent**. It never clobbers a runtime change or a prior seed, so a live `PUT /settings/...` stays authoritative. This is the first-boot / airgapped path; managed deployments are configured at runtime via the settings API.
Settings use the same Kubernetes-style manifest envelope as every other catalog resource — `apiVersion` + `kind: Setting` + `metadata.name` (the section key) + `spec` (the section's typed value). Files may hold multiple `---`-separated docs. metadata.name selecting an unregistered section, a spec that fails the section's Decode, or a non-Setting kind in the tree are all hard errors (fail fast on a typo). A missing dir is a no-op.
Returns the section names actually seeded, lexically sorted.
func SetLicenseGate ¶ added in v0.10.0
SetLicenseGate installs the Checker gated sections consult. Called once by the composition root before the first settings decode; until then every gated feature reads as unlicensed.
func SetSchemaRef ¶
func SetSchemaRef(name, ref string)
SetSchemaRef records the OpenAPI component name for section's typed value. Called by the HTTP layer right after huma registers the typed GET/PUT pair, so the per-section schema id is discoverable via the list / sections endpoints.
Types ¶
type Accounts ¶ added in v0.20.0
type Accounts struct {
// PersonalAccounts is the deployment's say on personal accounts; a group's or a user's own value overrides it.
PersonalAccounts string `` /* 338-byte string literal not displayed */
}
Accounts configures the accounts relay keeps for users.
func (*Accounts) PersonalAccountsAreOn ¶ added in v0.20.0
PersonalAccountsAreOn reports whether the section leaves personal accounts on; a nil section does.
type Audit ¶ added in v0.10.0
type Audit struct {
// RetentionDays is how long audit rows are kept. 0 disables pruning —
// deliberate, for deployments that archive the table externally.
RetentionDays int `json:"retentionDays" doc:"Days audit rows are kept; 0 keeps them forever."`
}
Audit configures the admin audit log.
type AuthOIDC ¶ added in v0.7.0
type AuthOIDC struct {
Enabled bool `json:"enabled" doc:"Offer OIDC sign-in on the control plane."`
// Issuer is the provider's issuer URL; endpoints are discovered from
// its metadata document.
Issuer string `json:"issuer,omitempty" doc:"The provider's https issuer URL; endpoints are discovered from it."`
ClientID string `json:"clientId,omitempty" doc:"OAuth client id registered with the provider."`
// ClientSecretEnv names the env var holding the client secret; it must
// start with RELAY_OIDC_ (or WYOLET_OIDC_). Indirection keeps the secret
// out of the settings row (world-readable to any authenticated operator).
ClientSecretEnv string `` /* 131-byte string literal not displayed */
// RedirectURL is this relay's public callback,
// e.g. https://relay.example.com/api/auth/oidc/callback.
RedirectURL string `json:"redirectUrl,omitempty" doc:"This relay's public callback URL, registered with the provider. Required when enabled."`
// Scopes defaults to ["openid", "profile", "email"].
Scopes []string `json:"scopes,omitempty" doc:"Scopes requested at sign-in. Omitted means openid, profile, email."`
// AuthParams are extra authorization-URL query params some providers
// require beyond the OIDC standard set (e.g. WorkOS AuthKit needs
// {"provider": "authkit"}). Provider-specific values live here in
// config, never in code.
AuthParams map[string]string `json:"authParams,omitempty" doc:"Extra query parameters some providers require on the authorization URL."`
// GroupsClaim names the id-token claim carrying the user's IdP groups
// (default "groups"); empty after an explicit "" write means the
// provider asserts none.
GroupsClaim *string `` /* 148-byte string literal not displayed */
// Registration gates first-login auto-provisioning: "open" creates a
// user row on first successful OIDC login; "closed" (default) rejects
// subjects with no existing user row.
Registration string `` /* 154-byte string literal not displayed */
// PostLoginURL is where the callback sends the browser after minting
// the session. Empty means "/" — correct when the admin UI is embedded
// (same origin as the callback). Set it to the UI's origin when the UI
// is served from a different hostname than the control API, so a login
// doesn't strand the user on the API origin.
PostLoginURL string `` /* 140-byte string literal not displayed */
}
AuthOIDC is the auth:oidc settings section: inbound OpenID Connect login for the control plane. Disabled by default — the zero value changes nothing about a deployment. When enabled, GET /auth/oidc/start redirects to the provider and /auth/oidc/callback exchanges the code and mints a normal relay session, so everything downstream of login is unchanged.
The provider is generic OIDC: any issuer publishing a discovery document (RFC 8414 / OpenID discovery) works. The client secret is referenced by env var name, never stored in the section value.
func AuthOIDCEnv ¶ added in v0.9.9
AuthOIDCEnv reads the WYOLET_* environment overlay. WYOLET_AUTH_MODE=oidc returns a fully-formed enabled section that short-circuits the DB-backed one — deployment env is the platform's config channel, and turning SSO on must not require a live DB write. Any other mode value (including the platform-contract "insecure-dev", which relay covers with password login) returns (nil, nil): overlay inactive. A malformed active overlay returns an error; callers on the boot path should treat it as fatal.
func AuthOIDCFrom ¶ added in v0.7.0
AuthOIDCFrom reads the typed section from a settings Reader, tolerating absent or mistyped values (returns the zero value → disabled).
func EffectiveAuthOIDC ¶ added in v0.9.9
EffectiveAuthOIDC is what handlers obey: the env overlay when active, else the DB-backed section. A malformed overlay resolves to the DB path here — the boot path has already fatal'd on it, so a running process never carries one.
func (*AuthOIDC) EffectiveGroupsClaim ¶ added in v0.10.0
EffectiveGroupsClaim returns the id-token claim to read groups from, or "" when the deployment has explicitly opted out.
func (*AuthOIDC) EffectiveScopes ¶ added in v0.7.0
EffectiveScopes returns Scopes or the OIDC default set.
func (*AuthOIDC) OpenRegistration ¶ added in v0.7.0
OpenRegistration reports whether first-login auto-provisioning is on.
type AuthSCIM ¶ added in v0.10.8
type AuthSCIM struct {
Enabled bool `json:"enabled" doc:"Serve SCIM 2.0 at /scim/v2; it answers 404 while off."`
// DeleteDisables makes a SCIM DELETE of a user disable the account instead of deleting it, keeping its audit trail and bindings.
DeleteDisables bool `` /* 131-byte string literal not displayed */
// LinkClaim names the verified id_token claim whose value a first OIDC sign-in matches against a SCIM-provisioned account's externalId: "sub" (the default when empty) or "oid".
LinkClaim string `` /* 167-byte string literal not displayed */
}
AuthSCIM is the auth:scim settings section: inbound SCIM 2.0 provisioning at /scim/v2 on the control listener. Off by default; while it is off the endpoint answers 404 and SCIM client tokens do nothing.
func AuthSCIMFrom ¶ added in v0.10.8
AuthSCIMFrom reads the typed section from a settings Reader, tolerating absent or mistyped values (returns the zero value: disabled).
func (*AuthSCIM) EffectiveLinkClaim ¶ added in v0.10.8
EffectiveLinkClaim returns the claim a first sign-in is linked on.
type AuthTokens ¶ added in v0.10.0
type AuthTokens struct {
Enabled bool `json:"enabled" doc:"Let signed-in users mint inference tokens."`
// DefaultTTL applies when a mint request names no ttl; MaxTTL caps what
// a request may ask for. Both are time.Duration — nanoseconds on the
// wire, as everywhere Go durations are serialized.
DefaultTTL time.Duration `json:"defaultTTL" doc:"Lifetime of a token whose mint names no ttl, in nanoseconds."`
MaxTTL time.Duration `json:"maxTTL" doc:"Longest lifetime a mint may ask for, in nanoseconds."`
// SigningKey points at the stored Ed25519 seed. Empty means "not
// generated yet": boot mints one, stores it through the master-key path,
// and writes the ref back here.
SigningKey secret.Ref `` /* 130-byte string literal not displayed */
// PreviousSigningKey is the ref rotation replaced. Tokens minted under
// it still verify, so a rotation is not a fleet-wide logout — every pod
// loads both refs at boot, not just the one it happened to rotate.
PreviousSigningKey secret.Ref `` /* 135-byte string literal not displayed */
// VerifyCacheSize bounds how many verified tokens the data plane keeps
// so a repeat request skips the Ed25519 verify. 0 uses the default;
// negative disables the cache.
VerifyCacheSize int `` /* 131-byte string literal not displayed */
}
AuthTokens is the auth:tokens settings section: short-lived, relay-signed inference tokens a logged-in user mints for a project. Enabled by default, but a deployment with no master key has nowhere to keep the signing key and stays token-less until one is configured.
func AuthTokensFrom ¶ added in v0.10.0
func AuthTokensFrom(r Reader) *AuthTokens
AuthTokensFrom reads the typed section from a settings Reader, tolerating absent or mistyped values (returns the defaults).
func (*AuthTokens) EffectiveVerifyCacheSize ¶ added in v0.10.0
func (a *AuthTokens) EffectiveVerifyCacheSize() int
EffectiveVerifyCacheSize resolves the configured bound, 0 meaning "disabled".
func (*AuthTokens) KeepSigningKeys ¶ added in v0.11.7
func (a *AuthTokens) KeepSigningKeys(current *AuthTokens) error
KeepSigningKeys carries current's signing-key refs onto a for an API write. Only rotation repoints them: a writer who chose the secret could sign tokens with it. A ref a leaves empty keeps current's; one naming a different secret is refused.
func (*AuthTokens) Validate ¶ added in v0.10.0
func (a *AuthTokens) Validate() error
Validate is enforced before any write.
type CatalogSource ¶ added in v0.5.0
type CatalogSource struct {
// Version is the catalog ref (tag) the last versioned seed ran from,
// e.g. "v0.1.0". Empty when the catalog was seeded without a version
// (local dir / embedded first-boot seed) or never seeded.
Version string `` /* 175-byte string literal not displayed */
// SeededAt is when that seed completed (RFC 3339).
SeededAt string `json:"seededAt,omitempty" doc:"When that seed completed, RFC 3339."`
}
CatalogSource records the provenance of the seeded catalog. Written by the bootstrap seeder after a successful versioned seed; compared against RELAY_CATALOG_VERSION at boot to decide whether a re-seed is due. An operator can blank Version via the settings API to force a re-seed on the next boot. Re-seeds only touch pristine template rows: operator- edited (dirty) rows are skipped and overlays re-merge at snapshot load, so user changes survive.
func (*CatalogSource) Validate ¶ added in v0.5.0
func (c *CatalogSource) Validate() error
type Governance ¶
type Governance struct {
AllowEdit bool `json:"allowEdit" doc:"Allow API edits of the kind's catalog-owned rows. Default true."`
AllowDelete bool `json:"allowDelete" doc:"Allow API deletes of the kind's catalog-owned rows. Default false."`
}
Governance is the per-resource mutation policy: whether a catalog-managed row of a given kind may be edited or deleted through the generic control CRUD API. One value type is shared by every governance:<kind> section so the shape — and the decision logic in Governs — stays uniform.
These toggles are a speed-bump against accidental mutation, not a wall: editing catalog rows is rare but safe (the router self-heals; nothing hard-depends on a specific row surviving), so AllowEdit defaults true. Deleting is the click-around risk, so AllowDelete defaults false and an operator flips it on when they actually mean to prune.
func (*Governance) Validate ¶
func (g *Governance) Validate() error
type Inference ¶
type Inference struct {
// KeyRotateMaxGrace caps, in seconds, how long a rotated key's previous
// hash keeps authenticating. Zero means the default below; rotation
// requests above the cap are rejected.
KeyRotateMaxGrace int `json:"keyRotateMaxGrace" doc:"Longest graceSeconds a key rotation may ask for; 0 means the default of one day."`
}
Inference controls authenticated-flow behavior.
func (*Inference) MaxRotateGrace ¶ added in v0.10.0
MaxRotateGrace resolves the configured cap, falling back to the default.
type License ¶ added in v0.10.0
type License struct {
// Value is the signed license file, verbatim. Empty is a community
// deployment.
Value string `json:"value,omitempty"`
}
License is the license settings section.
func LicenseFrom ¶ added in v0.10.0
LicenseFrom reads the typed section from a settings Reader, tolerating absent or mistyped values (returns the zero value → community).
type MutationError ¶
MutationError is returned by Governs when an operation is not permitted. The control layer maps it to a 403.
func (*MutationError) Error ¶
func (e *MutationError) Error() string
type OAuthProvider ¶ added in v0.4.2
type OAuthProvider struct {
oauth.ProviderConfig
}
OAuthProvider is the typed value of an oauth:<provider> settings section: the flow config (authorize/token endpoints, client id, scopes, authorize params) used to acquire and refresh that provider's OAuth credentials.
The relay core ships only this generic shape. Concrete provider values are operator/community config — register a provider's section with RegisterOAuthProvider and supply the values via the settings API or a config/settings/oauth-<provider>.yaml. No provider is registered by default.
func (*OAuthProvider) Validate ¶ added in v0.4.2
func (c *OAuthProvider) Validate() error
Validate enforces the minimum a flow + refresh needs.
type OTLPReceiver ¶ added in v0.10.3
type OTLPReceiver struct {
// Enabled accepts exports at POST /otlp/v1/traces and /otlp/v1/logs. Off by default: reported usage is self-declared by the client and is recorded, never enforced.
Enabled bool `` /* 153-byte string literal not displayed */
// CaptureContent stores the message content a client reports with a call (instructions, input and output messages, tool definitions) in the payload store. It takes effect only while payload logging is enabled, and a policy governing the reporting credential must allow payload logging. Off by default: content is the client's data and the largest part of an export.
CaptureContent bool `` /* 175-byte string literal not displayed */
}
OTLPReceiver configures the endpoints that accept telemetry clients report about model calls relay did not carry.
func OTLPReceiverFrom ¶ added in v0.10.3
func OTLPReceiverFrom(r Reader) *OTLPReceiver
OTLPReceiverFrom reads the typed section from a settings Reader, tolerating absent or mistyped values (returns the zero value: disabled).
func (*OTLPReceiver) Validate ¶ added in v0.10.3
func (o *OTLPReceiver) Validate() error
Validate is enforced before any write.
type Parsing ¶
type Parsing struct {
// RichParsing extracts per-request metadata and messages from the
// body (for attribution / observability). When false the relay
// reads only the minimal fields needed to route (model, stream),
// leaving metadata and messages unparsed — lower CPU on the hot
// path, no body-level observability.
//
// Default true. Hot-swappable: a change takes effect on the next
// request within a reconcile interval, no restart.
RichParsing bool `` /* 143-byte string literal not displayed */
}
Parsing controls inbound request-body parsing depth.
type PayloadClickHouse ¶
type PayloadClickHouse struct {
// WALDir overrides the local WAL segment directory; empty uses the
// boot default.
WALDir string `json:"walDir,omitempty" doc:"Local write-ahead-log directory; empty uses the boot default."`
// Dedup stores each distinct message, tool list and system prompt once
// and request bodies as references to them. Rows written either way
// stay readable.
Dedup bool `` /* 168-byte string literal not displayed */
}
PayloadClickHouse configures the ClickHouse backend (Langfuse-style: text bodies as ZSTD String columns, queryable). The DSN is NOT stored here — it reuses the relay's boot CH connection (RELAY_CH_DSN, the same cluster the usage sink uses), so no credentials live in this row. Only the per-backend knobs that are safe to hot-swap live here.
type PayloadFile ¶
type PayloadFile struct {
Path string `json:"path" doc:"JSONL file path; empty uses the boot default."`
}
PayloadFile configures the JSONL file backend.
type PayloadLogging ¶
type PayloadLogging struct {
// Enabled is the global master switch. When false the observer
// produces nothing regardless of per-request opt-in.
Enabled bool `json:"enabled" doc:"Master switch; while off nothing is captured whatever a key or policy asks."`
// Backend selects the sink: "file" (default), "s3", or "clickhouse".
Backend string `json:"backend" enum:",file,s3,clickhouse" doc:"Where captured bodies are stored. Empty means file."`
// MaxBytes caps each stored body, measured on the DECODED plaintext
// (compressed upstream bodies are decoded before capture); 0 = unlimited.
MaxBytes int `json:"maxBytes" doc:"Cap on each stored body in decoded bytes; 0 is unlimited."`
// RetentionDays bounds how long captured bodies are kept by the
// clickhouse backend; 0 keeps them forever. A stored row without the
// field decodes to DefaultPayloadRetentionDays, not to keep-forever.
RetentionDays int `` /* 130-byte string literal not displayed */
File PayloadFile `json:"file" doc:"File backend settings."`
S3 PayloadS3 `json:"s3" doc:"S3 backend settings."`
CH PayloadClickHouse `json:"clickhouse" doc:"ClickHouse backend settings."`
}
PayloadLogging configures the payloadlog observer. Off by default; the per-request opt-in (policy/key) still gates capture on top of Enabled. Credentials are secret.Refs resolved via pkg/secret, so they can live in env, encrypted-PG, or a future external backend — never as plaintext in this row.
func (*PayloadLogging) Validate ¶
func (p *PayloadLogging) Validate() error
Validate is enforced before any write. Only meaningful when Enabled — a disabled section can hold partial config (e.g. while an operator fills in S3 details before flipping it on). The S3 credentials and transport are checked regardless: the log reader builds from this section whatever the toggle says.
type PayloadS3 ¶
type PayloadS3 struct {
Endpoint string `json:"endpoint" doc:"S3 endpoint host, such as s3.amazonaws.com."`
Bucket string `json:"bucket" doc:"Bucket name; required for the s3 backend."`
Region string `json:"region,omitempty" doc:"Bucket region."`
Prefix string `json:"prefix,omitempty" doc:"Key prefix for stored objects."`
UseSSL bool `json:"useSSL" doc:"Use TLS; required unless plain HTTP is allowed by the deployment."`
AccessKey secret.Ref `` /* 126-byte string literal not displayed */
SecretKey secret.Ref `json:"secretKey" doc:"Reference to the secret access key, like accessKey."`
}
PayloadS3 configures the object-store backend. AccessKey/SecretKey are secret.Refs resolved at sink-build time: env names under RELAY_PAYLOAD_S3_ or stored ids under "payload-logging:".
type ProxyMode ¶
type ProxyMode struct {
// Enabled turns the proxy flow on. When false, requests without a
// valid relay key get 401, regardless of any other field below.
Enabled bool `` /* 137-byte string literal not displayed */
// AllowUnauthenticated lets proxy callers reach the upstream with
// no relay-side auth — the inbound Authorization header is forwarded
// as-is. When false, the proxy flow still requires a relay key
// (proxied traffic gets logged against that key) but the upstream
// credential comes from the caller.
AllowUnauthenticated bool `` /* 205-byte string literal not displayed */
}
ProxyMode controls whether the relay accepts inference requests where the caller brings their own upstream provider key instead of a relay key. The flow lives in app/proxy; the inference credential middleware enforces this section before the request body is read.
type Reader ¶
Reader is the narrow read surface Governs needs — satisfied by *catalog.Catalog. Settings cache reads are lock-free and total (a registered section always returns at least its Defaults).
type Row ¶
Row is a single settings row, decoded into a typed value via its section's Decode func. UpdatedAt is informational.
type Section ¶
type Section struct {
Name string
Description string
Defaults func() any
Decode func([]byte) (any, error)
SchemaRef string
}
Section describes one known settings section. Defaults returns a fresh zero-value instance; Decode parses raw JSON into a typed value and validates it; SchemaRef is the OpenAPI component name of the typed value's schema (set automatically by the per-section registerSettingsSection helper); Description is operator-facing prose explaining the section's purpose.
type SectionName ¶
type SectionName string
SectionName is a typed string whose OpenAPI schema is a string enum of every registered section. Use it in handler request/response types instead of bare `string` so the generated spec carries the closed set of valid section keys.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the data-access layer for settings rows.
func (*Store) Get ¶
Get returns the typed value for section. When no row exists, the section's Defaults() is returned with UpdatedAt zero — so the read path is total: every registered section always has a value.
type UsageClickHouse ¶
type UsageClickHouse struct {
WALDir string `json:"walDir,omitempty" doc:"Local write-ahead-log directory; empty uses the boot default."`
}
UsageClickHouse holds the safe-to-hot-swap CH knobs. The DSN reuses the boot CH connection (bootstrap-tier), so no credentials live in this row.
type UsageFile ¶
type UsageFile struct {
Path string `json:"path,omitempty" doc:"JSONL file path; empty uses the boot default."`
}
UsageFile configures the JSONL file backend.
type UsageLogging ¶
type UsageLogging struct {
// Backend selects the sink+reader: "file" (default), "clickhouse",
// "postgres", or "valkey".
Backend string `json:"backend" enum:",file,clickhouse,postgres,valkey" doc:"Where usage events are written and read. Empty means file."`
// RetentionDays bounds how long usage events are kept by the clickhouse
// and postgres backends; 0 keeps them forever. Applied to the existing
// table on change, so shortening it deletes history.
RetentionDays int `` /* 139-byte string literal not displayed */
File UsageFile `json:"file" doc:"File backend settings."`
CH UsageClickHouse `json:"clickhouse" doc:"ClickHouse backend settings."`
}
UsageLogging selects and tunes the log/usage event backend. Per the config direction (minimize env), the backend choice lives here, not in env; the legacy RELAY_EVENTLOG_BACKEND is honored only as an interim fallback when this section is unset, until the YAML→DB settings seed lands.
func (*UsageLogging) Validate ¶
func (u *UsageLogging) Validate() error
Validate enforces the backend enum + non-negative knobs.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package settingstest serves settings sections from memory for tests.
|
Package settingstest serves settings sections from memory for tests. |