fix: validate config after PostLoad hooks
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>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
// 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
|
||||
Reference in New Issue
Block a user