Documentation
¶
Index ¶
- func CheckErr(err error)
- func CheckErrf(format string, err error)
- func ConfigureCLI(v *viper.Viper, envPrefix string, flags []Flag, flagSet *pflag.FlagSet)
- func ConfigureLogging(v *viper.Viper, logLevels []string) error
- func ExpandEnvVars(v *viper.Viper, settings map[string]interface{})
- func HandleInterrupt(cleanup func())
- func MarshalConfig(v *viper.Viper, pretty bool, maskedFields ...string) ([]byte, error)
- func ParseStringSlice(v *viper.Viper, key string) []string
- type Flag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureCLI ¶
ConfigureCLI configures a Viper environment with flags and envs.
func ConfigureLogging ¶
ConfigureLogging configures the default logger with the right setup depending flag/envs. If logLevels is not nil, only logLevels values will be configured to Info/Debug depending on viper flags. if logLevels is nil, all sub-logs will be configured.
func ExpandEnvVars ¶
ExpandEnvVars expands env vars present in the config.
func HandleInterrupt ¶
func HandleInterrupt(cleanup func())
HandleInterrupt attempts to cleanup while allowing the user to force stop the process.
func MarshalConfig ¶
MarshalConfig marshals a *viper.Viper config to JSON. pretty controls if the result is indented or not. It replaces the masked fields with three asterisks, if they are present.
func ParseStringSlice ¶
ParseStringSlice returns a single slice of values that may have been set by either repeating a flag or using comma separation in a single flag. This is used to enable repeated flags as well as env vars that can't be repeated. In either case, Viper understands how to write the config entry as a list.