startup

package
v0.19.0 Latest Latest
Warning

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

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

Documentation

Overview

Package startup is what every command does before its own work: load the typed configuration, build the redacting logger from it and make that logger the log/slog default, so no line written by the command or a library bypasses the masking of personal data (ADR 0002).

A configuration that cannot be used stops the command before anything else runs, with a non-zero exit code and an error that never quotes a secret.

Every command logs to standard error: the MCP stdio transport allows a server to log there and reserves standard output for protocol messages (MCP specification 2025-06-18, Transports, stdio). The other commands follow for consistency.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(name string, lookup func(string) (string, bool), w io.Writer, run func(context.Context, config.Config) error) int

Run sets the command name up and runs it: it loads the configuration with lookup, such as os.LookupEnv, makes a redacting logger writing JSON lines to w the slog default and calls run with a context cancelled on SIGINT or SIGTERM, so that the command stops cleanly. It returns the process exit code: 0 when run succeeds, 1 after logging the error otherwise. run is not called when the configuration is invalid.

Types

This section is empty.

Jump to

Keyboard shortcuts

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