settingsapi

package
v1.122.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package settingsapi serves the /api/v1/admin/settings surface: the stored SMTP configuration (#631), the send-test action, the test recipient's notification opt-out status (#1022), and the knowledge review-queue alert threshold (#803). It is a decomposition seam of pkg/admin (which sits at the package size budget): the parent registers it on the admin mux and injects the request-scoped helpers it shares with the other admin routes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(mux *http.ServeMux, cfg Config)

Register mounts the settings routes on mux. Reads need only the store; writes need database config mode (405 otherwise, matching the other admin configuration surfaces).

Types

type Config

type Config struct {
	// Settings persists the admin SMTP configuration. nil disables every
	// route in this package.
	Settings smtp.SettingsStore
	// SendTest delivers a test email through the stored SMTP settings. nil
	// disables the test route.
	SendTest func(ctx context.Context, to string) error
	// Prefs reads per-address notification preferences so the test-send UI
	// can surface a target's opt-out state (#1022). nil disables the
	// recipient-status route.
	Prefs notification.PrefsStore
	// ReviewAlert persists the knowledge review-queue alert threshold
	// (#803). nil disables the review-queue-alert routes.
	ReviewAlert reviewalert.SettingsStore
	// ScriptReviewAlert persists the managed-script review-queue alert
	// threshold (#1287). nil disables the script-review-alert routes. It is a
	// separate store rather than a second section on one, because each store is
	// bound to the queue whose settings section it reads.
	ScriptReviewAlert reviewalert.SettingsStore
	// Mutable reports database config mode; false swaps the write routes for
	// ReadOnly.
	Mutable bool
	// Author resolves the acting admin for audit columns.
	Author func(*http.Request) string
	// Decode is the parent's strict JSON body decoder (unknown fields
	// rejected, size-capped); its error text is safe to return as the
	// problem detail.
	Decode func(w http.ResponseWriter, r *http.Request, dst any) error
	// ReadOnly is the parent's 405 not-available-in-file-mode responder.
	ReadOnly http.HandlerFunc
}

Config carries the stores and parent-owned helpers the routes need.

Jump to

Keyboard shortcuts

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