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

appconfig

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: Apache-2.0, MIT Imports: 20 Imported by: 0

Documentation

Overview

Package appconfig serves public and admin configuration endpoints.

Package appconfig holds admin-editable application settings (branding, sign-up policy, session lifetimes, email toggles) stored in the database and overlaid on internal/config env defaults.

Index

Constants

View Source
const ModuleName = "appconfig"

ModuleName identifies the appconfig module in the registry.

Variables

This section is empty.

Functions

func CIMDAllowlist

func CIMDAllowlist(values map[string]string) []string

CIMDAllowlist reads the operator-managed CIMD URL allowlist from the merged values (JSON array; default deny when unset).

Types

type MailSender

type MailSender interface {
	EnqueueEmail(ctx context.Context, msg mailer.Message) error
}

MailSender queues transactional email; internal/jobs implements it.

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module mounts the configuration endpoints.

func New

func New(mailer MailSender, opts ...Option) *Module

New builds the module. A nil mailer leaves the test-email route unmounted (fail closed); the config CRUD needs WithStore.

func (*Module) APIRoutes

func (m *Module) APIRoutes(r chi.Router)

APIRoutes mounts the retained public bootstrap endpoint relative to /api. The admin CRUD and test-email surfaces serve ConnectRPC exclusively (see handler_rpc.go).

func (*Module) MergedValues

func (m *Module) MergedValues(ctx context.Context) (map[string]string, error)

MergedValues folds the catalog defaults with the stored overrides — the cross-module read path (the registry wires the CIMD allowlist from it).

func (*Module) Name

func (*Module) Name() string

Name identifies the module.

func (*Module) RPCService added in v0.0.12

func (m *Module) RPCService(access kernel.AccessAuthenticator) (string, http.Handler)

RPCService returns the Connect registration for the application configuration surface. The public bootstrap view is anonymous; the admin read, update, and test email guard per procedure.

func (*Module) WithStore

func (m *Module) WithStore(store Store) *Module

WithStore wires the settings persistence; without it only test-email mounts.

type Option

type Option func(*Module)

Option configures the appconfig module at construction.

type PostgresStore

type PostgresStore struct {
	// contains filtered or unexported fields
}

PostgresStore persists overrides in public.app_config.

func NewPostgresStore

func NewPostgresStore(store datastore.Store) *PostgresStore

NewPostgresStore builds the production config store. The store supplies both the read/write executor and transactions.

func (*PostgresStore) List

func (s *PostgresStore) List(ctx context.Context) (map[string]string, error)

List returns every stored override.

func (*PostgresStore) Upsert

func (s *PostgresStore) Upsert(ctx context.Context, values map[string]string) error

Upsert writes the given keys in one transaction.

type Store

type Store interface {
	List(ctx context.Context) (map[string]string, error)
	Upsert(ctx context.Context, values map[string]string) error
}

Store persists configuration overrides. Catalog defaults are the bottom layer; rows here win. Environment-backed settings never reach this store.

Jump to

Keyboard shortcuts

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