Documentation ¶
Overview ¶
This file contains the ConfigFile type helpers
This file contains the Value interface implementation for the ConfigFile type which is used to specify a configuration file field on a configurature struct
This file provides the Configure function and its helpers ¶
This file contains the AddMapValueType[T] factory function and its helpers
This file contains config package's handlers for reflect types encountered in configuration parsing and handling
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrConfigNotLoaded is returned when the last loaded configuration is nil ErrConfigNotLoaded = errors.New("configuration not loaded - did you run Configure[]()?") // For disabling type caching DisableGetTypeCache = false )
Functions ¶
func AddMapValueType ¶
AddMapValueType creates a map value type based on the input mapping.
The function takes a mapping of string keys to values and registers it as a Configurature type.
func AddType ¶
AddType adds a custom type to the customFlagMap. You can also use this to replace the behavior of existing types.
Parameters: - structFieldType: The type of struct field - confValueT: *confValueT must implement the Value interface
Types ¶
type Options ¶
type Options struct { EnvPrefix string // Prefix for environment variables Args []string // Arguments to parse NilPtrs bool // Leave pointers set to nil if values aren't specified Usage func(*pflag.FlagSet) // Usage function called when configuration is incorrect or for --help NoRecover bool // Don't recover from panic ShowInternalFlags bool // Show hidden internal flags }
Configure options
type Value ¶
type Value interface { Interface() interface{} // Internal value as an interface{} Set(string) error // Set the internal value based on the string. If invalid, return error String() string // Internal value as a string Type() string // Type of the value. Appears in Usage() help }
Value interface for config types