Help us shape the future of Go! Take the 2026 Go Developer Survey

admin

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: AGPL-3.0 Imports: 68 Imported by: 0

Documentation

Overview

Package admin serves the core admin screens: dashboard widgets, users, roles, general and mail settings, system health and jobs, API keys, the audit viewer and the global admin search. It also publishes the mailer service (mailer.ServiceName) and the REST operations for those resources.

Index

Constants

View Source
const (
	SettingBackupScheduleHours  = "backup.schedule_hours"
	SettingBackupRetain         = "backup.retain"
	SettingBackupScheduleLast   = "backup.schedule.last"
	SettingBackupScheduleState  = "backup.schedule.state"
	SettingBackupLastSuccess    = "backup.local.last_success"
	SettingBackupRemoteSchedule = "backup.schedule.remote_destination"
)

Local backup schedule / retention settings (System → Backups).

View Source
const (
	CheckOK   = "ok"
	CheckWarn = "warn"
	CheckFail = "fail"
)

Health check statuses.

View Source
const (
	SettingRetainDoneDays  = "jobs.retain_done_days"
	SettingRetainDeadDays  = "jobs.retain_dead_days"
	SettingRetainKeyedDays = "jobs.retain_keyed_days"
)

Retention settings of the jobs.prune cron (whole days).

View Source
const (
	PermUsers    = "users.manage"
	PermSettings = "settings.manage"
	PermHealth   = "system.health"
	PermAPIKeys  = "api_keys.manage"
	PermBackup   = "system.backup"
	PermUpdate   = "system.update"
)

Permissions used by the admin screens.

View Source
const (
	CatalogKindCore      = "core"
	CatalogKindFeature   = "feature"
	CatalogKindService   = "service"
	CatalogKindExtension = "extension"

	CatalogSourceBuiltIn  = "built-in"
	CatalogSourceExternal = "external"

	CompatBuiltIn            = "built_in"
	CompatManifestUnverified = "manifest_unverified"
	CompatNotInBuild         = "not_in_build"
)

Catalog entry kinds and sources.

View Source
const (
	AIProviderOpenAI    = "openai"
	AIProviderAnthropic = "anthropic"

	// DefaultAnthropicModel is defaultAnthropicModel for other packages (pricing tests).
	DefaultAnthropicModel = defaultAnthropicModel
)

AI writing providers (setting ai.provider; "" turns the helper off).

View Source
const (
	SettingWorkspace = "site.workspace"
	WorkspaceSimple  = "simple"
	WorkspaceFull    = "full"
)

Site workspace mode: progressive disclosure for operators who want a plain CMS versus Agents + Commerce. Empty means unset (full nav until chosen; first-run surfaces a chooser).

View Source
const HealthCheckFilter = "system.health.checks"

HealthCheckFilter is the hooks filter other modules use to contribute checks to System Health. The payload is *[]admin.HealthCheck; append to it and return it.

View Source
const LogoProtocolPNG = "images-png-v1"
View Source
const ModuleCatalogFilter = "system.catalog.entries"

ModuleCatalogFilter is the hooks filter later modules use to add their own entries to the module catalog (GET /system/modules and System → Modules). The payload is *[]admin.CatalogEntry; the ext module appends one entry per installed external extension.

View Source
const ModuleRequirementFilter = "system.capabilities.modules"

ModuleRequirementFilter is the hooks filter modules use to report their configuration state to GET /site/capabilities. The payload is *[]admin.ModuleRequirement; append one entry per module.

View Source
const (
	PermCapabilityTest = "system.capability_test"
)

Capability evidence levels. A connectivity check (list models, discover tools, probe a bucket) proves reachability only. An operation test exercises the real operation with an isolated sample under an explicit permission: send one mail to the requesting operator, write/read/delete one probe object, request one tiny completion. MCP tool invocation would execute remote actions, so MCP has no operation test. Nothing here runs during a page load or a GET.

View Source
const ServiceCanvasRead = "admin.canvases"

ServiceCanvasRead is the kernel service name for grant-scoped canvas reads.

Variables

View Source
var ErrAIDestinationChanged = errors.New("admin: ai destination changed since it was reviewed")

ErrAIDestinationChanged is returned by CompleteWorkAgentBounded when the destination no longer matches the fingerprint that was reviewed.

View Source
var ErrAIModelUnsupported = errors.New("admin: the ai client cannot drive this model")

ErrAIModelUnsupported is returned before any request for a model the shared client cannot drive: OpenAI reasoning models (gpt-5 family, o-series) require max_completion_tokens on chat/completions, which the client does not send.

View Source
var ErrLogoChanged = errors.New("logo destination or adapter changed")
View Source
var ErrLogoProvider = errors.New("image request failed; outcome may be uncertain; do not retry automatically")
View Source
var ErrLogoUnavailable = errors.New("static PNG adapter unavailable")

Functions

func AIClientCannotDrive added in v0.16.0

func AIClientCannotDrive(provider, model string) bool

AIClientCannotDrive reports such a model.

func AIConfig

func AIConfig(provider, baseURL, model, apiKey string, keyStored bool, secretKey []byte) (map[string]any, map[string]string)

AIConfig validates an AI writing configuration exactly as Settings → AI does and returns the settings to store (the API key encrypted with secretKey; omitted when apiKey is blank) and field errors as i18n keys. keyStored says whether a key is already stored. The CLI uses it too.

func AIDestinationFingerprint added in v0.16.0

func AIDestinationFingerprint(ctx context.Context, d *kernel.Deps, connectionID string) (string, bool)

AIDestinationFingerprint is the fingerprint part of AIDestination.

func CompleteWorkAgent

func CompleteWorkAgent(ctx context.Context, d *kernel.Deps, connectionID, model, system, input string) (string, error)

CompleteWorkAgent reuses the configured server-side provider and encrypted connection registry. It executes a text-only turn, never tool calls.

func CompleteWorkAgentBounded added in v0.16.0

func CompleteWorkAgentBounded(ctx context.Context, d *kernel.Deps, connectionID, model, system, input string, maxTokens int, expectFingerprint string) (string, error)

CompleteWorkAgentBounded sends one bounded request to the destination read in a single pass. When expectFingerprint is not empty, the fingerprint of that same read must match it, so the request that goes out is built from exactly the values that were reviewed.

func CompleteWorkAgentReview added in v0.17.0

func CompleteWorkAgentReview(ctx context.Context, d *kernel.Deps, request ReviewCompletionRequest) (string, error)

func FilterNavForWorkspace added in v0.4.0

func FilterNavForWorkspace(mode string, items []kernel.NavItem) []kernel.NavItem

FilterNavForWorkspace drops Agents/Commerce surfaces in simple mode.

func FormatLogoAmount added in v0.16.0

func FormatLogoAmount(micros int64) string

FormatLogoAmount prints currency units without floating-point price rounding.

func GenerateIdentityLogoBounded added in v0.16.0

func GenerateIdentityLogoBounded(ctx context.Context, d *kernel.Deps, approved LogoImagePrepared) ([]byte, error)

func PostsPerPage

func PostsPerPage(value string) (int, bool)

PostsPerPage parses a site.posts_per_page value (an integer 1–100).

func SaveIdentityLogoBinding added in v0.16.0

func SaveIdentityLogoBinding(ctx context.Context, d *kernel.Deps, id string, b LogoBinding) error

func ValidateGeneralSetting

func ValidateGeneralSetting(key, value string) (string, error)

ValidateGeneralSetting validates and normalises one Settings → General value exactly as the admin screen does, for the keys that need no other service: site.title (required, trimmed, max 500 runes), site.tagline (trimmed, max 500 runes), site.locale (a supported locale), site.timezone (an IANA name; "" and "Local" are rejected) and site.base_url (absolute http(s) origin, no trailing slash). It returns the value to store, or a *SettingError. Other keys (site.theme and site.front_page need the theme and content services, site.logo the media service) are rejected with code "admin.settings.error_key". contact.email must be empty or a plain address; site.posts_per_page an integer 1–100 (returned in canonical decimal form; store it as a number, see PostsPerPage).

func ValidateSEOSetting

func ValidateSEOSetting(key, value string) (string, error)

ValidateSEOSetting validates one Settings → SEO value. The rules belong to the seo module (seo.ValidateSetting); this alias keeps the admin settings validators in one place for callers such as mcp.

func WorkAgentProviderReady

func WorkAgentProviderReady(ctx context.Context, d *kernel.Deps, connectionID, model string) bool

WorkAgentProviderReady verifies configuration and credential readability, without sending a request or claiming the provider is reachable.

func WorkAgentReviewBinding added in v0.17.0

func WorkAgentReviewBinding(ctx context.Context, d *kernel.Deps, connectionID, model string) (string, string, error)

WorkAgentReviewBinding reads configuration without contacting the provider. The opaque MAC includes credentials but cannot disclose them to API consumers.

func WorkspaceMode added in v0.4.0

func WorkspaceMode(ctx context.Context, s *settings.Store) string

WorkspaceMode returns simple, full, or "" when unset / unknown.

func WorkspaceShowsAdvanced added in v0.4.0

func WorkspaceShowsAdvanced(ctx context.Context, s *settings.Store) bool

WorkspaceShowsAdvanced is true when Agents / Commerce / AI surfaces should appear (full mode, or unset so existing installs keep working).

Types

type AIConnectionSummary added in v0.16.0

type AIConnectionSummary struct {
	ID, Name, Provider, Model, Host, TestStatus string
}

AIConnectionSummary describes an AI destination for display in other modules (the optional identityai module): never a secret.

func AIDestination added in v0.16.0

func AIDestination(ctx context.Context, d *kernel.Deps, connectionID string) (AIConnectionSummary, string, bool)

AIDestination returns, from one read, what the operator is shown for connectionID ("" is the writing settings) and the fingerprint of exactly those stored values. ok is false when the destination cannot be resolved (missing, invalid, or an unreadable credential).

func ListAIConnections added in v0.16.0

func ListAIConnections(ctx context.Context, d *kernel.Deps) ([]AIConnectionSummary, error)

ListAIConnections lists the valid saved AI connection profiles: id, name, provider, model, the host the request really goes to (the saved endpoint) and the last recorded test status.

func WritingAIDestination added in v0.16.0

func WritingAIDestination(ctx context.Context, d *kernel.Deps) (AIConnectionSummary, bool)

WritingAIDestination describes the site's writing settings (ai.*) as a destination: provider, model and host, without the key.

type CanvasDocument added in v0.11.0

type CanvasDocument struct {
	ID        string       `json:"id"`
	Title     string       `json:"title"`
	UpdatedAt string       `json:"updated_at"`
	Version   int64        `json:"version"`
	Cards     []canvasCard `json:"cards"`
	Edges     []canvasEdge `json:"edges"`
}

CanvasDocument is get_canvas / GET /api/v1/canvases/{id} (no secrets).

type CanvasReader added in v0.11.0

type CanvasReader interface {
	List(ctx context.Context, page, perPage int) ([]CanvasSummary, int, error)
	Get(ctx context.Context, id string) (*CanvasDocument, error)
}

CanvasReader is the grant-scoped list/get surface for MCP and REST.

type CanvasSummary added in v0.11.0

type CanvasSummary struct {
	ID        string `json:"id"`
	Title     string `json:"title"`
	UpdatedAt string `json:"updated_at"`
	Version   int64  `json:"version"`
}

CanvasSummary is one board in list_canvases / GET /api/v1/canvases.

type CapabilityCheck added in v0.14.0

type CapabilityCheck struct {
	Kind               string  `json:"kind" enum:"connectivity,operation"`
	Scope              string  `json:"scope" doc:"What exactly ran, e.g. connectivity, operation:send, operation:write_read_delete, operation:complete"`
	Status             string  `json:"status" enum:"passed,failed,unknown,stale,expired,waiting,running"`
	Result             string  `` /* 131-byte string literal not displayed */
	CheckedAt          *string `json:"checked_at" doc:"Persisted RFC3339 time of the saved result; null if missing or invalid"`
	ExpiresAt          *string `json:"expires_at" doc:"When the evidence stops counting (checked_at + 7 days); null when unknown"`
	ConfigurationMatch *bool   `json:"configuration_match" doc:"Null for legacy checks not bound to a configuration revision"`
	Reason             string  `json:"reason"`
	Remediation        string  `json:"remediation"`
}

CapabilityCheck describes evidence, not a promise that a future operation will succeed. Kind says what ran: a connectivity/discovery check or an explicit operation test.

type CapabilityReport added in v0.14.0

type CapabilityReport struct {
	ObservedAt  string            `json:"observed_at" doc:"When this local snapshot was read, not a health-check timestamp"`
	Modules     []CapabilityState `json:"modules"`
	Services    []CapabilityState `json:"services" doc:"Core services that are not modules (mail)"`
	Connections []CapabilityState `json:"connections"`
	Coverage    string            `json:"coverage"`
}

CapabilityReport is GET /site/capabilities.

type CapabilityState added in v0.14.0

type CapabilityState struct {
	ID                  string           `json:"id"`
	Kind                string           `json:"kind" enum:"module,service,ai,mcp,s3,unknown"`
	Available           bool             `json:"available"`
	Enabled             *bool            `` /* 133-byte string literal not displayed */
	Configured          *bool            `` /* 139-byte string literal not displayed */
	Connected           *bool            `json:"connected" doc:"True only for a current, unexpired, passed connectivity check; null when never checked"`
	Tested              bool             `json:"tested" doc:"True only for a current, unexpired, passed operation test; connectivity never sets this flag"`
	OperationSupported  bool             `json:"operation_supported" doc:"Whether a safe operation test exists for this kind"`
	Source              string           `json:"source"`
	ConfigurationStatus string           `json:"configuration_status" enum:"configured,incomplete,unknown"`
	Reason              string           `json:"reason"`
	Remediation         string           `json:"remediation"`
	LastCheck           *CapabilityCheck `json:"last_check" doc:"Last saved connectivity check, or null; GET never runs one"`
	Operation           *CapabilityCheck `json:"operation" doc:"Last saved operation test, or null; GET never runs one"`
}

CapabilityState separates facts we can observe from facts not yet reported. Null configured/enabled values must not be interpreted as false or success.

type CatalogConfiguration added in v0.16.0

type CatalogConfiguration struct {
	Status      string `json:"status" enum:"configured,incomplete,not_required,unknown"`
	Reason      string `json:"reason,omitempty"`
	Remediation string `json:"remediation,omitempty"`
}

CatalogConfiguration is the module's own verdict on its settings.

type CatalogEntry added in v0.16.0

type CatalogEntry struct {
	ID                   string                     `json:"id"`
	Kind                 string                     `json:"kind" enum:"core,feature,service,extension"`
	Name                 map[string]string          `json:"name" doc:"Display name by locale (ar, en)"`
	Summary              map[string]string          `json:"summary" doc:"What it does, by locale"`
	Source               string                     `json:"source" enum:"built-in,external"`
	Version              string                     `json:"version" doc:"Build version for built-ins, manifest version for extensions"`
	Compatibility        string                     `` /* 243-byte string literal not displayed */
	Owner                string                     `json:"owner,omitempty" doc:"Core module that owns a service"`
	Dependencies         []string                   `json:"dependencies" doc:"Modules it needs (declared)"`
	OptionalDependencies []string                   `json:"optional_dependencies" doc:"Modules it uses when present"`
	Dependents           []string                   `json:"dependents" doc:"Modules that need or use it"`
	Permissions          []string                   `json:"permissions"`
	State                CatalogState               `json:"state"`
	Configuration        CatalogConfiguration       `json:"configuration"`
	Registered           *kernel.ModuleRegistration `json:"registered,omitempty" doc:"Observed registrations of this boot; absent while off"`
	Jobs                 CatalogJobs                `json:"jobs"`
	Messages             []CatalogMessage           `json:"messages"`
	Links                map[string]string          `json:"links,omitempty"`
}

CatalogEntry describes one module, core service or external extension: what it does, where it comes from, what it depends on, what it registered in this process, whether it is on, and whether it needs configuration. Every field states what was observed; "unknown" is an honest value.

type CatalogJobs added in v0.16.0

type CatalogJobs struct {
	Kinds  []string `json:"kinds" doc:"Job kinds registered now, or last known while off"`
	Queued int      `json:"queued" doc:"Queued, claimable by a worker"`
	Parked int      `json:"parked" doc:"Queued but held because the module is off"`
}

CatalogJobs is the background work attributed to the entry.

type CatalogMessage added in v0.16.0

type CatalogMessage struct {
	Level string            `json:"level" enum:"info,warning"`
	Text  map[string]string `json:"text"`
}

CatalogMessage is an actionable note shown with the entry.

type CatalogState added in v0.16.0

type CatalogState struct {
	Status         string `json:"status" enum:"enabled,disabled,pending_enable,pending_disable,unavailable,always_on,active,installed,error"`
	Available      bool   `json:"available"`
	Enabled        bool   `json:"enabled" doc:"Booted in this process"`
	Optional       bool   `json:"optional" doc:"Can be switched off"`
	Mode           string `json:"mode,omitempty" doc:"Operator config mode (GORUN_ADDONS), if any"`
	Desired        *bool  `json:"desired" doc:"Activation the next boot will apply; null when not optional"`
	PendingRestart bool   `json:"pending_restart" doc:"Desired differs from the booted state"`
	Switchable     bool   `json:"switchable" doc:"The activation can be changed here (optional and not forced by config)"`
}

CatalogState is the activation of an entry: the booted state, the desired state (setting or config), and whether a restart is pending.

type HealthCheck

type HealthCheck struct {
	Name        string `json:"name"`
	Status      string `json:"status"` // ok | warn | fail
	Detail      string `json:"detail"`
	OptionalOff bool   `json:"-"`
}

HealthCheck is one line of the System Health "Checks" list.

type KeyCreateRequest

type KeyCreateRequest struct {
	Name       string   `json:"name"`
	Kind       string   `json:"kind" doc:"api (default) | agent"`
	Scopes     []string `json:"scopes" doc:"permission names, or [\"*\"]; never more than the caller holds (session callers only)"`
	RatePerMin int      `json:"rate_per_min" doc:"default 60"`
	ExpiresAt  string   `json:"expires_at" doc:"RFC3339, empty for never"`
}

KeyCreateRequest is the POST /v1/keys body.

type KeyDTO

type KeyDTO struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Prefix      string   `json:"prefix" doc:"first characters after gp_, shown to identify the key"`
	Kind        string   `json:"kind" doc:"api | agent"`
	UserID      string   `json:"user_id"`
	Scopes      []string `json:"scopes"`
	RatePerMin  int      `json:"rate_per_min"`
	ExpiresAt   string   `json:"expires_at"`
	LastUsedAt  string   `json:"last_used_at"`
	UseCount    int64    `json:"use_count" doc:"approximate; flushed at most once a minute"`
	CreatedAt   string   `json:"created_at"`
	RevokedAt   string   `json:"revoked_at"`
	RotatedFrom string   `json:"rotated_from"`
	Status      string   `json:"status" doc:"active | expired | revoked"`
}

KeyDTO is an API key as the key console API returns it (never the secret).

type KeyRotateRequest

type KeyRotateRequest struct {
	GraceSeconds int `json:"grace_seconds" doc:"0 revokes the old key now; up to 604800 keeps it working that long"`
}

KeyRotateRequest is the POST /v1/keys/{id}/rotate body.

type KeySecretResponse

type KeySecretResponse struct {
	Key   KeyDTO `json:"key"`
	Token string `json:"token"`
}

KeySecretResponse is returned once by create and rotate: token is the plaintext key and is never shown again.

type LatestRelease added in v0.15.0

type LatestRelease struct {
	Status     string  `json:"status" enum:"fresh,stale,failed,waiting,running,unknown" doc:"unknown: no source configured or never observed"`
	Version    *string `json:"version" doc:"Null when unknown"`
	Artifact   *string `json:"artifact"`
	ObservedAt *string `json:"observed_at" doc:"When the saved value was read from the source"`
	AgeSeconds *int64  `json:"age_seconds"`
	Source     string  `json:"source"`
	Error      string  `json:"error" doc:"Sanitized reason of the newest failed attempt"`
}

LatestRelease is the saved background observation of the trusted source.

type LogoBinding added in v0.16.0

type LogoBinding struct {
	Version           string `json:"version"`
	ConnectionVersion string `json:"connection_version"`
	Protocol          string `json:"protocol"`
	Model             string `json:"model"`
	Quality           string `json:"quality"`
	Background        string `json:"background"`
	EstimateMicros    int64  `json:"estimate_micros"`
	Currency          string `json:"currency"`
	Source            string `json:"source"`
	AsOf              string `json:"as_of"`
	Basis             string `json:"basis"`
}

LogoBinding is an explicit administrator declaration, not model discovery. Estimate is a locally reviewed estimate, never a provider-enforced charge cap.

type LogoImageInput added in v0.16.0

type LogoImageInput struct {
	ConnectionID, Theme, Prompt string
	Size                        int
	BudgetMicros                int64
	Currency                    string
}

type LogoImagePrepared added in v0.16.0

type LogoImagePrepared struct {
	Input                                                                                    LogoImageInput
	Name, Provider, Model, Host, Fingerprint, CapabilityFingerprint, Evidence, PromptVersion string
	StaticPNG                                                                                bool
	Quote                                                                                    LogoImageQuote
	Payload                                                                                  json.RawMessage
}
func PrepareIdentityLogo(ctx context.Context, d *kernel.Deps, in LogoImageInput, version string) (LogoImagePrepared, error)

type LogoImageQuote added in v0.16.0

type LogoImageQuote struct {
	Known                                  bool
	AmountMicros                           int64
	Currency, Source, Version, AsOf, Basis string
}

type LogoProfile added in v0.16.0

type LogoProfile struct {
	ID, Version, Name, Provider, Model, Host string
	Binding                                  LogoBinding
	Configured                               bool
	Estimate                                 string
}

func ListIdentityLogoProfiles added in v0.16.0

func ListIdentityLogoProfiles(ctx context.Context, d *kernel.Deps) ([]LogoProfile, error)

type Module

type Module struct{}

Module is the admin kernel.Module.

func New

func New() *Module

New returns the admin module.

func (*Module) Catalogs

func (*Module) Catalogs() fs.FS

Catalogs implements kernel.CatalogProvider.

func (*Module) Migrations

func (*Module) Migrations() fs.FS

Migrations implements kernel.Module.

func (*Module) Name

func (*Module) Name() string

Name implements kernel.Module.

func (*Module) Register

func (*Module) Register(d *kernel.Deps) error

Register declares permissions, publishes the mailer, adds nav items, dashboard widgets, admin routes and API operations.

type ModuleActivation added in v0.16.0

type ModuleActivation struct {
	Enabled *bool `json:"enabled"`
}

ModuleActivation is the body of PUT /system/modules/{name}/activation. Enabled is required: a missing or null value is rejected (422) rather than read as false, so a malformed request can never switch a module off.

type ModuleCatalog added in v0.16.0

type ModuleCatalog struct {
	ObservedAt string         `json:"observed_at"`
	Build      string         `json:"build"`
	Entries    []CatalogEntry `json:"entries"`
	Coverage   string         `json:"coverage"`
}

ModuleCatalog is GET /system/modules.

type ModuleRequirement added in v0.15.0

type ModuleRequirement struct {
	Module      string `json:"module"`
	Configured  bool   `json:"configured"`
	Reason      string `json:"reason"`
	Remediation string `json:"remediation"`
}

ModuleRequirement is a module's own configuration verdict: whether its required settings are present, why not, and the practical repair step.

type ReviewCompletionRequest added in v0.17.0

type ReviewCompletionRequest struct {
	ConnectionID, Model, Binding, System, Input string
}

ReviewCompletionRequest pins the approved destination and credentials to a single resolved configuration, rather than reloading it after checking consent.

type SettingError

type SettingError struct{ Key, Code string }

SettingError is a rejected setting value; Code is an i18n key.

func (*SettingError) Error

func (e *SettingError) Error() string

type SettingsDTO

type SettingsDTO struct {
	SiteTitle           string `json:"site.title"`
	SiteTagline         string `json:"site.tagline"`
	SiteLocale          string `json:"site.locale"`
	SiteTimezone        string `json:"site.timezone"`
	SiteBaseURL         string `json:"site.base_url"`
	SiteTheme           string `json:"site.theme"`
	SiteFrontPage       string `json:"site.front_page"`
	SiteLogoDark        string `json:"site.logo_dark" doc:"Media id shown on dark backgrounds; empty falls back to site.logo"`
	SiteLogoLight       string `json:"site.logo_light" doc:"Media id shown on light backgrounds; empty falls back to site.logo"`
	SiteIcon            string `json:"site.icon" doc:"Media id for the favicon / app icon"`
	ContactEmail        string `json:"contact.email"`
	PostsPerPage        int    `json:"site.posts_per_page"`
	MailProvider        string `json:"mail.provider"`
	MailResendAPIKeySet bool   `json:"mail.resend_api_key_set"`
	MailHost            string `json:"mail.host"`
	MailPort            int    `json:"mail.port"`
	MailUsername        string `json:"mail.username"`
	MailFrom            string `json:"mail.from"`
	MailFromName        string `json:"mail.from_name"`
	MailTLS             string `json:"mail.tls"`
	MailReplyTo         string `json:"mail.reply_to"`
	MailPasswordSet     bool   `json:"mail.password_set"`
}

SettingsDTO is the GET /v1/settings response (and the PATCH response). mail.password is never returned; mail.password_set reports whether one is stored.

type SettingsPatchDTO

type SettingsPatchDTO struct {
	SiteTitle        *string `json:"site.title,omitempty"`
	SiteTagline      *string `json:"site.tagline,omitempty"`
	SiteLocale       *string `json:"site.locale,omitempty"`
	SiteTimezone     *string `json:"site.timezone,omitempty"`
	SiteBaseURL      *string `json:"site.base_url,omitempty"`
	SiteTheme        *string `json:"site.theme,omitempty"`
	SiteFrontPage    *string `json:"site.front_page,omitempty"`
	SiteLogoDark     *string `json:"site.logo_dark,omitempty"`
	SiteLogoLight    *string `json:"site.logo_light,omitempty"`
	SiteIcon         *string `json:"site.icon,omitempty"`
	ContactEmail     *string `json:"contact.email,omitempty"`
	PostsPerPage     *int    `json:"site.posts_per_page,omitempty"`
	MailProvider     *string `json:"mail.provider,omitempty"`
	MailResendAPIKey *string `json:"mail.resend_api_key,omitempty"`
	MailHost         *string `json:"mail.host,omitempty"`
	MailPort         *int    `json:"mail.port,omitempty"`
	MailUsername     *string `json:"mail.username,omitempty"`
	MailPassword     *string `json:"mail.password,omitempty"`
	MailFrom         *string `json:"mail.from,omitempty"`
	MailFromName     *string `json:"mail.from_name,omitempty"`
	MailTLS          *string `json:"mail.tls,omitempty"`
	MailReplyTo      *string `json:"mail.reply_to,omitempty"`
}

SettingsPatchDTO documents the PATCH /v1/settings body: send only the keys to change. "mail.password": null clears the stored password, "" keeps it, any other string replaces it (stored encrypted). Unknown keys are rejected.

type TestHelper added in v0.15.0

type TestHelper struct{ App *kernel.App }

TestHelper exposes test-only encoding helpers to external test packages. It is compiled into the package but only useful from tests.

func (*TestHelper) EncryptSecrets added in v0.15.0

func (h *TestHelper) EncryptSecrets(t *testing.T, token, access, secret string) string

EncryptSecrets encrypts a connection secret bundle with the app's secret key.

type UpdateStatus added in v0.15.0

type UpdateStatus struct {
	RunningVersion  string            `json:"running_version" doc:"Serving process identity (build string)"`
	IsRelease       bool              `json:"is_release" doc:"False for development builds, which cannot be compared"`
	AcceptedVersion *string           `json:"accepted_version" doc:"Last target durably accepted by a completed operation; null if none"`
	Latest          LatestRelease     `json:"latest"`
	UpdateAvailable *bool             `json:"update_available" doc:"Null when latest or the running identity is unknown"`
	Configured      bool              `json:"configured" doc:"A trusted release source is configured"`
	Source          string            `json:"source"`
	Adapter         string            `json:"adapter" enum:"manual,coolify"`
	Active          *update.Operation `json:"active" doc:"Pending or running operation; null when idle"`
	Last            *update.Operation `json:"last" doc:"Most recent operation; null when none"`
}

UpdateStatus is GET /system/update. Latest, accepted, activated and requested versions are reported separately and never conflated.

Source Files

Jump to

Keyboard shortcuts

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