f2b6c07ff7
Re-run validator after PostLoad, return errors from RootDir, and add Config alias for C(). Hooks receive *T instead of *Manager. Co-authored-by: Cursor <cursoragent@cursor.com>
21 lines
774 B
Go
21 lines
774 B
Go
// Package config loads and validates typed configuration files using viper and
|
|
// go-playground/validator.
|
|
//
|
|
// # Workflow
|
|
//
|
|
// Define a struct with mapstructure and validate tags, create a [Manager] with
|
|
// [NewManager], optionally configure hooks via [Manager.WithOpts], then call
|
|
// [Manager.Load] during startup. Use [Manager.C] or [Manager.Config] for quick
|
|
// access after load.
|
|
//
|
|
// # Environment overrides
|
|
//
|
|
// Set [ManagerOpts.EnvPrefix] or call [Manager.WithEnvOverride]. Nested keys use
|
|
// dots in YAML and underscores in env vars (for example MYAPP_DATABASE_USER).
|
|
//
|
|
// # Root directory discovery
|
|
//
|
|
// [RootDir] and [MustRootDir] locate a marker file by walking up from the working
|
|
// directory—useful when config lives near a repo root.
|
|
package config
|