config

package
v0.0.0-...-389bc3b Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Env config

Env 全局的配置变量

Functions

func AddConfigPath

func AddConfigPath(in string)

func AddRemoteProvider

func AddRemoteProvider(provider, endpoint, path string) error

func AddSecureRemoteProvider

func AddSecureRemoteProvider(provider, endpoint, path, secretkeyring string) error

func AllKeys

func AllKeys() []string

func AllSettings

func AllSettings() map[string]interface{}

func AutomaticEnv

func AutomaticEnv()

func BindEnv

func BindEnv(input ...string) error

func BindFlagValue

func BindFlagValue(key string, flag FlagValue) error

func BindFlagValues

func BindFlagValues(flags FlagValueSet) (err error)

func BindPFlag

func BindPFlag(key string, flag *pflag.Flag) error

func BindPFlags

func BindPFlags(flags *pflag.FlagSet) error

func ConfigFileUsed

func ConfigFileUsed() string

func Debug

func Debug()

func Get

func Get(key string) interface{}

func GetBool

func GetBool(key string) bool

func GetDuration

func GetDuration(key string) time.Duration

func GetFloat64

func GetFloat64(key string) float64

func GetInt

func GetInt(key string) int

func GetInt32

func GetInt32(key string) int32

func GetInt64

func GetInt64(key string) int64

func GetSizeInBytes

func GetSizeInBytes(key string) uint

func GetString

func GetString(key string) string

func GetStringMap

func GetStringMap(key string) map[string]interface{}

func GetStringMapString

func GetStringMapString(key string) map[string]string

func GetStringMapStringSlice

func GetStringMapStringSlice(key string) map[string][]string

func GetStringSlice

func GetStringSlice(key string) []string

func GetTime

func GetTime(key string) time.Time

func InConfig

func InConfig(key string) bool

func IsSet

func IsSet(key string) bool

func LoadConfig

func LoadConfig()

LoadConfig 加载配置文件

func MergeConfig

func MergeConfig(in io.Reader) error

func MergeInConfig

func MergeInConfig() error

func OnConfigChange

func OnConfigChange(run func(in fsnotify.Event))

func ReadConfig

func ReadConfig(in io.Reader) error

func ReadInConfig

func ReadInConfig() error

func ReadRemoteConfig

func ReadRemoteConfig() error

func RegisterAlias

func RegisterAlias(alias string, key string)

func SafeWriteConfig

func SafeWriteConfig() error

func SafeWriteConfigAs

func SafeWriteConfigAs(filename string) error

func Set

func Set(key string, value interface{})

func SetConfigFile

func SetConfigFile(in string)

func SetConfigName

func SetConfigName(in string)

func SetConfigType

func SetConfigType(in string)

func SetDefault

func SetDefault(key string, value interface{})

func SetEnvKeyReplacer

func SetEnvKeyReplacer(r *strings.Replacer)

func SetEnvPrefix

func SetEnvPrefix(in string)

func SetFs

func SetFs(fs afero.Fs)

func SetTypeByDefaultValue

func SetTypeByDefaultValue(enable bool)

func Unmarshal

func Unmarshal(rawVal interface{}) error

func UnmarshalExact

func UnmarshalExact(rawVal interface{}) error

func UnmarshalKey

func UnmarshalKey(key string, rawVal interface{}) error

func WatchConfig

func WatchConfig()

func WatchRemoteConfig

func WatchRemoteConfig() error

func WatchRemoteConfigOnChannel

func WatchRemoteConfigOnChannel() error

func WriteConfig

func WriteConfig() error

func WriteConfigAs

func WriteConfigAs(filename string) error

Types

type Config

type Config = viper.Viper

Config viper.Vpier alias

func Sub

func Sub(key string) *Config

type FlagValue

type FlagValue = viper.FlagValue

type FlagValueSet

type FlagValueSet = viper.FlagValueSet

Jump to

Keyboard shortcuts

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