Documentation ¶
Overview ¶
Package xviper provides customizations on use of viper for configuration loading.
Deprecated: xviper is no longer planned to be used by future WebPA/XMiDT services.
This package is frozen and no new functionality will be added.
Index ¶
- func AddStandardConfigPaths(c Configer, applicationName string)
- func BindConfig(c Configer, fl FlagLookup, fileFlag, nameFlag string) bool
- func BindConfigFile(c Configer, fl FlagLookup, flag string) bool
- func BindConfigName(c Configer, fl FlagLookup, flag string) bool
- func MustKeyUnmarshal(u KeyUnmarshaler, k string, v interface{})
- func MustUnmarshal(u Unmarshaler, v interface{})
- type Configer
- type FlagLookup
- type InvalidUnmarshaler
- type KeyUnmarshaler
- type Unmarshaler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddStandardConfigPaths ¶
AddStandardConfigPaths adds the standard *nix-style configuration paths
func BindConfig ¶
func BindConfig(c Configer, fl FlagLookup, fileFlag, nameFlag string) bool
BindConfig attempts first to bind the configuration file via BindConfigFile. Failing that, it attempts to bind the configuration name via BindConfigName. If either succeeds, this function returns true. Otherwise, if no binding took place, this function returns false.
func BindConfigFile ¶
func BindConfigFile(c Configer, fl FlagLookup, flag string) bool
BindConfigName extracts the path of the Viper configuration file from a flagset. If the given flag is set, its value is passed to c.SetConfigFile and this function returns true. If the flag was missing, this method returns false and the supplied Configer is not changed.
This function is useful to allow the fully-qualified path of the file that Viper uses to be specified or overridden from the command line.
func BindConfigName ¶
func BindConfigName(c Configer, fl FlagLookup, flag string) bool
BindConfigName extracts the name of the Viper configuration file from a flagset. If the given flag is set, its value is passed to c.SetConfigName and this function returns true. If the flag was missing, this method returns false and the supplied Configer is not changed.
This function is useful to allow the name of the file that Viper searches for to be specified or overridden from the command line.
func MustKeyUnmarshal ¶
func MustKeyUnmarshal(u KeyUnmarshaler, k string, v interface{})
MustKeyUnmarshal attempts to unmarshal the given key, panicing on any error
func MustUnmarshal ¶
func MustUnmarshal(u Unmarshaler, v interface{})
MustUnmarshal attempts to unmarshal the value, panicing on any error.
Types ¶
type Configer ¶
Configer is the subset of Viper behavior dealing with configuration paths and locations
type FlagLookup ¶
FlagLookup is the behavior expected of a pflag.FlagSet to lookup individual flags by longhand name.
type InvalidUnmarshaler ¶
type InvalidUnmarshaler struct {
Err error
}
InvalidUnmarshaler is an Unmarshaler that simply returns an error. Mostly useful for testing.
func (InvalidUnmarshaler) Unmarshal ¶
func (iu InvalidUnmarshaler) Unmarshal(interface{}, ...viper.DecoderConfigOption) error
type KeyUnmarshaler ¶
KeyUnmarshaler describes the subset of Viper behavior for unmarshaling an arbitrary configuration key.
type Unmarshaler ¶
type Unmarshaler interface {
Unmarshal(interface{}, ...viper.DecoderConfigOption) error
}
Unmarshaler describes the subset of Viper behavior dealing with unmarshaling into arbitrary values.