Documentation
¶
Index ¶
- func AllConfigKeys() []string
- func BindFlag(key string, flag *pflag.Flag) error
- func BindFlagSet(flagSet *pflag.FlagSet) error
- func ChangedConfigs() map[string]interface{}
- func EnsureConfigFileExists() error
- func Get(key string) (interface{}, error)
- func GetBool(key string) bool
- func GetInt(key string) int
- func GetString(key string) string
- func InitViper() error
- func RequiresRestartMsg(key, _ string) string
- func Set(key string, value interface{}) (string, error)
- func SetDefaults()
- func SuccessfullyApplied(key, value string) string
- func Unset(key string) (string, error)
- func ValidateBool(value interface{}) (bool, string)
- func ValidateBundle(value interface{}) (bool, string)
- func ValidateCPUs(value interface{}) (bool, string)
- func ValidateIPAddress(value interface{}) (bool, string)
- func ValidateMemory(value interface{}) (bool, string)
- func ValidateNoProxy(value interface{}) (bool, string)
- func ValidatePath(value interface{}) (bool, string)
- func ValidateURI(value interface{}) (bool, string)
- func WriteConfig() error
- type SetFn
- type Setting
- type ValidationFnType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllConfigKeys ¶
func AllConfigKeys() []string
AllConfigKeys returns all the known config keys A known config key is one which was registered through AddSetting - config keys with a default value - config keys with a value set - config keys with no value set
func BindFlagSet ¶
BindFlagset binds a flagset to their respective config properties
func ChangedConfigs ¶
func ChangedConfigs() map[string]interface{}
ChangedConfigs returns all the changed config keys/values 'changed' means config keys with a value set either because they are set in the config file, or because they were changed at runtime. This does not include config keys with no default value, or with a default value
func EnsureConfigFileExists ¶
func EnsureConfigFileExists() error
EnsureConfigFileExists creates the viper config file if it does not exists
func RequiresRestartMsg ¶
func SetDefaults ¶
func SetDefaults()
func SuccessfullyApplied ¶
func ValidateBool ¶
ValidateBool is a fail safe in the case user makes a typo for boolean config values
func ValidateBundle ¶
ValidateBundle checks if provided bundle path is valid
func ValidateCPUs ¶
ValidateCPUs checks if provided cpus count is valid in the config
func ValidateIPAddress ¶ added in v1.14.0
ValidateIP checks if provided IP is valid
func ValidateMemory ¶
ValidateMemory checks if provided memory is valid in the config
func ValidateNoProxy ¶
ValidateNoProxy checks if the NoProxy string has the correct format
func ValidatePath ¶
ValidatePath checks if provided path is exist
func ValidateURI ¶
ValidateURI checks if given URI is valid
Types ¶
type Setting ¶ added in v1.14.0
type Setting struct {
Name string
// contains filtered or unexported fields
}
func AddSetting ¶
func AddSetting(name string, defValue interface{}, validationFn []ValidationFnType, callbackFn []SetFn) *Setting
AddSetting returns a filled struct of ConfigSetting takes the config name and default value as arguments
type ValidationFnType ¶
validationFnType takes the key, value as args and checks if valid