settings

package
v1.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package settings provides cached, typed access to platform-wide key/value settings stored in the database. Consumers (auth flow, middleware) read runtime configuration through Provider; the admin API writes via the repo and calls Invalidate.

Index

Constants

View Source
const (
	KeyMaintenanceMode          = "maintenance_mode"
	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"
	KeyAuditLogRetentionDays          = "audit_log_retention_days"
	// Per-application resource caps. 0 = unlimited.
	KeyMaxCPUCores = "max_cpu_cores"
	KeyMaxMemoryMB = "max_memory_mb"

	// KeyExternalBaseDomain is the wildcard base domain for one-click external
	// access (e.g. "apps.example.com", DNS *.apps.example.com). Empty = off.
	// KeyExternalBaseProvider names the Goma certManager provider used for the
	// generated routes ("" = the gateway's default provider).
	KeyExternalBaseDomain   = "external_base_domain"
	KeyExternalBaseProvider = "external_base_provider"

	// KeyCustomLabelsEnabled is the fleet-wide kill-switch for user-defined Docker
	// labels on app containers (Traefik &c.). 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"
)

Well-known setting keys. Only a subset is enforced today; the rest are stored and surfaced in the admin UI.

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 NewProvider

func NewProvider(repo *repositories.SettingRepository, envOverrides map[string]string) *Provider

NewProvider builds a provider and loads the cache. Defaults are seeded once (missing keys only); existing admin values are never overwritten. envOverrides maps setting keys to env-provided values (e.g. external_base_domain from MIABI_EXTERNAL_BASE_DOMAIN): a non-empty value is authoritative and re-applied on every boot, so the platform can be configured declaratively; an empty value leaves the key admin-managed. Pass nil for no overrides.

func (*Provider) Bool

func (p *Provider) Bool(key string, def bool) bool

Bool returns a boolean setting, or def when unset/unparseable.

func (*Provider) Int

func (p *Provider) Int(key string, def int) int

Int returns an integer setting, or def when unset/unparseable.

func (*Provider) Invalidate

func (p *Provider) Invalidate()

Invalidate refreshes the cache from the database. Call after a write.

func (*Provider) String

func (p *Provider) String(key, def string) string

String returns a string setting, or def when unset.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL