vipercfg

package
v3.13.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2017 License: Apache-2.0, Apache-2.0 Imports: 4 Imported by: 46

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bind

func Bind()

Deprecated

func Config

func Config() *viper.Viper

Deprecated

func Load

func Load()

Deprecated

func OwlDefaultPflagDefiner

func OwlDefaultPflagDefiner()

Default Pflag definer of OWL

func Parse

func Parse()

Deprecated

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

type PflagDefiner

type PflagDefiner func()

Gets called before pflag.Parse()

Jump to

Keyboard shortcuts

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