Documentation
¶
Overview ¶
Package config loads environment variables into typed application configuration. It uses reflection for configuration decoding, independently of build-time DI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnvironmentValues ¶
EnvironmentValues reads optional layered files without changing process state. Reserved PFW_ENV/PFW_ENV_DIR selectors are never supplied by dotenv files.
Types ¶
type EnvironmentValidator ¶
type EnvironmentValidator interface{ ValidateEnvironment(pfw.Environment) error }
type Error ¶
type Error struct{ Fields []*FieldError }
type FieldError ¶
type FieldError struct{ Field, Variable, Reason string }
func (*FieldError) Error ¶
func (e *FieldError) Error() string
type Options ¶
type Options struct {
Prefix string
// Lookup defaults to os.LookupEnv. Supply an isolated lookup in tests.
Lookup func(string) (string, bool)
// EnvFiles are read in order; later files override earlier ones. Lookup wins.
EnvFiles []string
// IgnoreMissingEnvFiles ignores absent files, never syntax/read errors.
IgnoreMissingEnvFiles bool
// Environment selects .env, .env.<name>, .env.<name>.local when EnvFiles is empty.
Environment pfw.Environment
EnvDir string
}
Click to show internal directories.
Click to hide internal directories.