Documentation
¶
Overview ¶
Package settings holds the helpers an application needs on top of github.com/jessevdk/go-flags: every setting is an option with paired `long:` and `env:` tags, required settings fail at startup and name their environment variable, and credentials are Secrets that don't print.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
Parse parses args with p and runs the active command, like p.ParseArgs, with one difference: a required option whose value is empty counts as missing. go-flags alone accepts an environment variable that exists but is empty, so a required DATABASE_URL= passes it.
A missing option fails before any command runs, with a *flags.Error of type flags.ErrRequired that names every missing option by both its flag and its environment variable. Create p without flags.PrintErrors, or go-flags prints its own message first.
Types ¶
type Secret ¶
type Secret string
Secret is a string setting that doesn't print: fmt, slog and JSON show it redacted. Reveal returns the value.
func (Secret) MarshalText ¶
MarshalText redacts the secret for encoding/json and other text encoders.