Documentation ¶
Index ¶
- func Bind()
- func Config() *viper.Viper
- func Load()
- func OwlDefaultPflagDefiner()
- func Parse()
- type ConfigLoader
- func (loader *ConfigLoader) BuildFacadeConfig() (*viper.Viper, error)
- func (loader *ConfigLoader) LoadConfigFile() (*viper.Viper, error)
- func (loader *ConfigLoader) MustLoadConfigFile() *viper.Viper
- func (loader *ConfigLoader) MustParseCmd() *viper.Viper
- func (loader *ConfigLoader) ParseCmd() (*viper.Viper, error)
- func (loader *ConfigLoader) ProcessTrueValueCallbacks()
- type PflagDefiner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConfigLoader ¶
type ConfigLoader struct { // The definer of pflag FlagDefiner PflagDefiner // If the value of string is true, the mapped function would be called TrueValueCallbacks map[string]func() // contains filtered or unexported fields }
Used for parsing arguments of command line and loading file of configuration
The method could be called by multiple times without reloading.
LoadConfigFile() would call ParseCmd() to get the file path of configuration.
func NewOwlConfigLoader ¶
func NewOwlConfigLoader() *ConfigLoader
func (*ConfigLoader) BuildFacadeConfig ¶
func (loader *ConfigLoader) BuildFacadeConfig() (*viper.Viper, error)
Loads the configuration which combines both arguments of command line and configuration file.
Priorities:
1. Arguments of command line, which overrides: 2. Properties of config file
func (*ConfigLoader) LoadConfigFile ¶
func (loader *ConfigLoader) LoadConfigFile() (*viper.Viper, error)
Loads configuration from command line, panic if there is error
func (*ConfigLoader) MustLoadConfigFile ¶
func (loader *ConfigLoader) MustLoadConfigFile() *viper.Viper
Loads configuration from command line, panic if there is error while parsing JSON
func (*ConfigLoader) MustParseCmd ¶
func (loader *ConfigLoader) MustParseCmd() *viper.Viper
Loads configuration from command line, panic if there is error while parsing
func (*ConfigLoader) ParseCmd ¶
func (loader *ConfigLoader) ParseCmd() (*viper.Viper, error)
Loads configuration from command line
func (*ConfigLoader) ProcessTrueValueCallbacks ¶
func (loader *ConfigLoader) ProcessTrueValueCallbacks()
Executes callback for true values