helpers

package
v0.0.0-...-0d7ecfb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapEnvVarToFlag

func MapEnvVarToFlag(vars map[string]string, flagset *pflag.FlagSet) error

MapEnvVarToFlag takes a mapping of ENV var names to flag names and iterates over that mapping attempting to set the flag value with the ENV var key name. see: https://github.com/spf13/viper/issues/461

func SetFlagsFromEnv

func SetFlagsFromEnv(fs *pflag.FlagSet, prefix string) (err error)

SetFlagsFromEnv parses all registered flags in the given flagset, and if they are not already set it attempts to set their values from environment variables. Environment variables take the name of the flag but are UPPERCASE, and any dashes are replaced by underscores. Environment variables additionally are prefixed by the given string followed by and underscore. For example, if prefix=PREFIX: some-flag => PREFIX_SOME_FLAG

func SetupLogger

func SetupLogger(logLevelStr string, useDefaultFormatter bool, fields log.Fields) log.FieldLogger

SetupLogger is responsible for building up a basic logrus FieldLogger instance with a specific log level and fields configuration.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL