settingsapi

package
v1.110.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package settingsapi serves the /api/v1/admin/settings/smtp surface: the stored SMTP configuration (#631), the send-test action, and the test recipient's notification opt-out status (#1022). 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 notification.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
	// 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