settingshttp

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MailModeSMTP = "smtp"

	MailModeDev = "dev"

	// MailModeResend labels the Resend HTTP email channel
	// (notify/adapters/email/resend) — the /config mail_mode value and the
	// admin status badge share it (shuijing already used the string).
	MailModeResend = "resend"
)

Variables

This section is empty.

Functions

func MountAdmin

func MountAdmin(mux webx.Router, d AdminDeps)

Types

type AdminDeps

type AdminDeps struct {
	Store *settings.Store

	Guard func(http.Handler) http.Handler

	Mailer Mailer

	// MailModeFn reports the active mail channel (MailModeDev / MailModeSMTP)
	// and is read per request so hot-swapped mailers stay truthful. Breaking
	// change vs the old static MailMode string. nil = not tracked: the list
	// response carries an empty "mail_mode" and testEmail takes the smtp
	// branch (same as the old empty-string default).
	MailModeFn func() string

	// OAuthInfo optionally reports the configured OAuth providers together
	// with their EXPECTED callback URLs (derived from the configured base
	// URL, for comparison against what is registered in the provider
	// console). The actual runtime callback is computed per-request from
	// Host + X-Forwarded-Proto, so reverse proxies must forward both. A nil
	// func omits the "oauth" field from the list response entirely
	// (silently degrade when unwired).
	OAuthInfo func() []OAuthProviderInfo

	Log *slog.Logger
}

type Mailer

type Mailer interface {
	Send(ctx context.Context, to, subject, body string) error
}

type OAuthProviderInfo added in v0.8.0

type OAuthProviderInfo struct {
	Name        string `json:"name"`
	CallbackURL string `json:"callback_url"`
}

OAuthProviderInfo describes one OAuth provider for the admin status card.

Jump to

Keyboard shortcuts

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