Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfMgr ¶
type ConfMgr struct {
// Set Log if you want to see extra logging from config manager
Log *log.Logger
//
ConfigPaths []string
EnvVarPrefix string
// contains filtered or unexported fields
}
func NewConfMgr ¶
NewConfMgr creates new instance of ConfMgr configName is name of config file name without extension
type ConfigReader ¶
type ConfigReader interface {
// ReadConfig reads config from config file, env vars or flags. In case of error fails with os.Exit(1)
ReadConfig(flags *pflag.FlagSet, rawVal interface{}) error
BindFlag(confKey string, flag *pflag.Flag) error
}
CodefigReader allows commands to read configuration from config file, env vars or flags.
Flags have precedence over env vars and evn vars have precedence over config file.
Flags mapped to config struct filed automatically if their name includes path to field.
For example:
type NestedConf struct {
Foo string
}
type Config struct{
Nested NestedConf
}
in that case flag --nested.foo will be mapped automatically This flag could be also set by UKAMA_NESTED_FOO env var or by creating config file .ukama.yaml: nested:
foo: bar
type GlobalConfig ¶
type GlobalConfig struct {
Verbose bool
}
Click to show internal directories.
Click to hide internal directories.