Documentation ¶
Overview ¶
Package config implements a tiny wrapper around Viper.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ViperConfig ¶
ViperConfig is a wrapper for viper.Viper.
func NewWrapper ¶
func NewWrapper(v *viper.Viper) *ViperConfig
NewWrapper returns a *ViperConfig for the provided *viper.Viper.
func (*ViperConfig) BindConfig ¶
func (v *ViperConfig) BindConfig(key string)
BindConfig is a shortcut for the viper.SetDefault/viper.BindEnv pattern. It uses the provided key to perform the following on the underlying viper.Viper: * The default is set to nil. * The key is bound to an environment variable that matches the key, uppercased. Panics if the binding fails.
func (*ViperConfig) BindConfigAndOverrideEnvVar ¶
func (v *ViperConfig) BindConfigAndOverrideEnvVar(key string, envVarNameOverride string)
BindConfigAndOverrideEnvVar is a shortcut for the viper.SetDefault/viper.BindEnv pattern. It uses the provided key to perform the following on the underlying viper.Viper: * The default is set to nil. * The key is bound to an environment variable, using the provided override. If the override is a zero-value string, it will use the envvar name matching the key, uppercased (i.e. the same behavior as BindConfig). Panics if the binding fails.