Documentation
¶
Overview ¶
Package settings provides cached, typed access to platform-wide key/value settings stored in the database. Consumers such as the auth flow and middleware read runtime configuration through Provider; the admin API writes via the repo and calls Invalidate.
Index ¶
Constants ¶
const ( KeyMaintenanceMode = "maintenance_mode" // Self-service sign-up itself is not here: it is fixed at boot from // MIABI_REGISTRATION_ENABLED (config.RegistrationEnabled). These two shape the // policy that applies once it is open. KeyRequireEmailVerification = "require_email_verification" KeyAllowedSignupDomains = "allowed_signup_domains" KeyDefaultWorkspaceRole = "default_workspace_role" KeyMaxWorkspacesPerUser = "max_workspaces_per_user" // KeyMaxWorkspaceMembershipsPerUser caps how many workspaces a user may JOIN // as a non-owner member (0 = unlimited). KeyMaxWorkspaceMembershipsPerUser = "max_workspace_memberships_per_user" // KeyWorkspaceCreation is the platform's workspace creation mode (models.WorkspaceCreation*), the // default an organization that sets none falls back to. KeyWorkspaceCreation = "workspace_creation" // KeyInvitationSignupEnabled lets an invitee create their account from the invitation, even while // self-service sign-up is closed: the invitation is the authorization. KeyInvitationSignupEnabled = "invitation_signup_enabled" KeyAuditLogRetentionDays = "audit_log_retention_days" // Per-application resource caps. 0 = unlimited. KeyMaxCPUCores = "max_cpu_cores" KeyMaxMemoryMB = "max_memory_mb" // KeyCustomLabelsEnabled is the fleet-wide kill-switch for user-defined Docker labels on app containers. When // false, custom labels are disabled everywhere regardless of any plan capability; when true, the per-plan // AllowCustomLabels capability decides. Default true. KeyCustomLabelsEnabled = "custom_labels_enabled" // KeyRepoPipelinesEnabled is the fleet-wide kill-switch for adopting a pipeline out of a repository's // .miabi/pipeline.yaml. Adopting one lets the repository choose the step images and shell commands a runner // executes, so an operator can disable it entirely; git apps then always build directly. Default true. KeyRepoPipelinesEnabled = "repo_pipelines_enabled" // KeyControlManagerMode is how far the control manager goes: "observe" reports workloads that disappeared // from their node or cluster, "off" stops watching. Observe is the default because it acts on nothing. KeyControlManagerMode = "control_manager_mode" )
Well-known setting keys. Only a subset is enforced today; the rest are stored and surfaced in the admin UI.
const ( DefaultMaxWorkspacesPerUser = 10 DefaultMaxWorkspaceMembershipsPerUser = -1 // DefaultWorkspaceCreation changes nothing for accounts that predate it: none of them signed up // from an invitation. DefaultWorkspaceCreation = models.WorkspaceCreationExceptInvited )
defaults seeds first-boot values. Keys absent here can still be created by the admin via the API. Defaults for the per-user workspace limits, shared by the seed and the read fallback so a missing row behaves exactly like a fresh install. Owned is a generous anti-abuse bound rather than a product limit; joins are unlimited because a user cannot join unasked — an owner must invite them, and each workspace's own member quota already bounds that.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider caches settings in memory and exposes typed getters.
func NewFixedProvider ¶ added in v1.9.6
Invalidate refreshes the cache from the database. Call after a write. NewFixedProvider builds a provider over a fixed cache and no backing store, for callers that need to exercise settings-driven behaviour without a database.
func NewProvider ¶
func NewProvider(repo *repositories.SettingRepository, envOverrides map[string]string) *Provider
NewProvider builds a provider and loads the cache. Defaults are seeded once, for missing keys only, so existing admin values are never overwritten. envOverrides maps setting keys to env-provided values: a non-empty value is authoritative and re-applied on every boot; an empty one leaves the key admin-managed.
func (*Provider) Invalidate ¶
func (p *Provider) Invalidate()
func (*Provider) Pinned ¶ added in v1.9.6
Pinned reports whether an environment variable supplies this key, which makes it read-only in the console.
func (*Provider) PinnedKeys ¶ added in v1.9.6
PinnedKeys lists every env-supplied key, for an API that has to tell the console what it may not edit.