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 takes a slice of string keys and values and registers it as a string->value map Configurature type.
func AddType ¶
func AddType[structFieldType any]()
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
Types ¶
type ConfigFile ¶
type ConfigFile string
Type representing a config file setting
func (*ConfigFile) Set ¶ added in v1.0.3
func (f *ConfigFile) Set(v string) error
func (*ConfigFile) String ¶ added in v1.0.3
func (f *ConfigFile) String() string
func (*ConfigFile) Type ¶ added in v1.0.3
func (f *ConfigFile) Type() string
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 NoShortHelp bool // Don't add "h" as a short help flag }
Configure options