viper

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// SupportedExts describes the supported configuration formats
	// for the wrapper to avoid importing the spf13/viper package.
	// NOTE: This is a copy of spf13/viper.SupportedExts,
	// with the exception of the "ini" format, since its marshaller
	// does not have a thread-safe implementation.
	SupportedExts = []string{"dotenv", "env", "hcl", "json", "properties", "props", "prop", "toml", "yaml", "yml"}
)

Functions

func AddConfigPath

func AddConfigPath(in string)

AddConfigPath wraps viper's method.

func AddRemoteProvider

func AddRemoteProvider(provider, endpoint, path string) error

AddRemoteProvider wraps viper's method.

func AddSecureRemoteProvider

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

AddSecureRemoteProvider wraps viper's method.

func AllKeys

func AllKeys() []string

AllKeys wraps viper's method.

func AllSettings

func AllSettings() map[string]interface{}

AllSettings wraps viper's method.

func BindEnv

func BindEnv(in ...string) error

BindEnv wraps viper's method.

func BindFlagValue

func BindFlagValue(key string, flag viper.FlagValue) error

BindFlagValue wraps viper's method.

func BindFlagValues

func BindFlagValues(flags viper.FlagValueSet) error

BindFlagValues wraps viper's method.

func BindPFlag

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

BindPFlag wraps viper's method.

func BindPFlags

func BindPFlags(flags *pflag.FlagSet) error

BindPFlags wraps viper's method.

func Debug

func Debug()

Debug wraps viper's method.

func Get

func Get(key string) interface{}

Get wraps viper's method.

func GetBool

func GetBool(key string) bool

GetBool returns the value associated with the key as a boolean.

func GetDuration

func GetDuration(key string) time.Duration

GetDuration returns the value associated with the key as a duration.

func GetFloat64

func GetFloat64(key string) float64

GetFloat64 returns the value associated with the key as a float64.

func GetInt

func GetInt(key string) int

GetInt returns the value associated with the key as an integer.

func GetInt32

func GetInt32(key string) int32

GetInt32 returns the value associated with the key as an integer.

func GetInt64

func GetInt64(key string) int64

GetInt64 returns the value associated with the key as an integer.

func GetIntSlice

func GetIntSlice(key string) []int

GetIntSlice returns the value associated with the key as a slice of int values.

func GetSizeInBytes

func GetSizeInBytes(key string) uint

GetSizeInBytes wraps viper's method.

func GetString

func GetString(key string) string

GetString returns the value associated with the key as a string.

func GetStringMap

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

GetStringMap returns the value associated with the key as a map of interfaces.

func GetStringMapString

func GetStringMapString(key string) map[string]string

GetStringMapString returns the value associated with the key as a map of strings.

func GetStringMapStringSlice

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

GetStringMapStringSlice returns the value associated with the key as a map to a slice of strings.

func GetStringSlice

func GetStringSlice(key string) []string

GetStringSlice returns the value associated with the key as a slice of strings.

func GetTime

func GetTime(key string) time.Time

GetTime returns the value associated with the key as time.

func GetUint

func GetUint(key string) uint

GetUint returns the value associated with the key as an unsigned integer.

func GetUint32

func GetUint32(key string) uint32

GetUint32 returns the value associated with the key as an unsigned integer.

func GetUint64

func GetUint64(key string) uint64

GetUint64 returns the value associated with the key as an unsigned integer.

func InConfig

func InConfig(key string) bool

InConfig wraps viper's method.

func IsSet

func IsSet(key string) bool

IsSet wraps viper's method.

func MergeConfig

func MergeConfig(in io.Reader) error

MergeConfig wraps viper's method.

func MergeConfigMap

func MergeConfigMap(cfg map[string]interface{}) error

MergeConfigMap wraps viper's method.

func MergeInConfig

func MergeInConfig() error

MergeInConfig wraps viper's method.

func ReadConfig

func ReadConfig(in io.Reader) error

ReadConfig wraps viper's method.

func ReadConfigFile

func ReadConfigFile(path string) error

ReadConfigFile wraps viper's method.

func ReadRemoteConfig

func ReadRemoteConfig() error

ReadRemoteConfig wraps viper's method.

func RegisterAlias

func RegisterAlias(alias string, key string)

RegisterAlias wraps viper's method.

func SafeWriteConfig

func SafeWriteConfig() error

SafeWriteConfig wraps viper's method.

func SafeWriteConfigAs

func SafeWriteConfigAs(filename string) error

SafeWriteConfigAs wraps viper's method.

func Set

func Set(key string, val interface{})

Set wraps viper's method.

func SetDefault

func SetDefault(key string, val interface{})

SetDefault wraps viper's method.

func Unmarshal

func Unmarshal(rawVal interface{}, opts ...viper.DecoderConfigOption) error

Unmarshal wraps viper's method.

func UnmarshalExact

func UnmarshalExact(rawVal interface{}, opts ...viper.DecoderConfigOption) error

UnmarshalExact wraps viper's method.

func UnmarshalKey

func UnmarshalKey(key string, rawVal interface{}, opts ...viper.DecoderConfigOption) error

UnmarshalKey wraps viper's method.

func WatchConfig

func WatchConfig()

WatchConfig wraps viper's method.

func WatchRemoteConfig

func WatchRemoteConfig() error

WatchRemoteConfig wraps viper's method.

func WatchRemoteConfigOnChannel

func WatchRemoteConfigOnChannel() error

WatchRemoteConfigOnChannel wraps viper's method.

func WriteConfig

func WriteConfig() error

WriteConfig wraps viper's method.

func WriteConfigFile

func WriteConfigFile(filename string) error

WriteConfigFile wraps viper's method.

Types

type Viper

type Viper struct {
	// contains filtered or unexported fields
}

Viper wraps spf13 viper configuration registry.

func GetViper

func GetViper() *Viper

GetViper returns the global viper instance.

func New

func New() *Viper

New returns constructed viper instance.

func Sub

func Sub(key string) *Viper

Sub wraps viper's method.

func (*Viper) AddConfigPath

func (v *Viper) AddConfigPath(in string)

AddConfigPath wraps viper's method.

func (*Viper) AddRemoteProvider

func (v *Viper) AddRemoteProvider(provider, endpoint, path string) error

AddRemoteProvider wraps viper's method.

func (*Viper) AddSecureRemoteProvider

func (v *Viper) AddSecureRemoteProvider(provider, endpoint, path, secret string) error

AddSecureRemoteProvider wraps viper's method.

func (*Viper) AllKeys

func (v *Viper) AllKeys() []string

AllKeys wraps viper's method.

func (*Viper) AllSettings

func (v *Viper) AllSettings() map[string]interface{}

AllSettings wraps viper's method.

func (*Viper) BindEnv

func (v *Viper) BindEnv(in ...string) error

BindEnv wraps viper's method.

func (*Viper) BindFlagValue

func (v *Viper) BindFlagValue(key string, flag viper.FlagValue) error

BindFlagValue wraps viper's method.

func (*Viper) BindFlagValues

func (v *Viper) BindFlagValues(flags viper.FlagValueSet) error

BindFlagValues wraps viper's method.

func (*Viper) BindPFlag

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

BindPFlag wraps viper's method.

func (*Viper) BindPFlags

func (v *Viper) BindPFlags(flags *pflag.FlagSet) error

BindPFlags wraps viper's method.

func (*Viper) Debug

func (v *Viper) Debug()

Debug wraps viper's method.

func (*Viper) Get

func (v *Viper) Get(key string) interface{}

Get wraps viper's method.

func (*Viper) GetBool

func (v *Viper) GetBool(key string) bool

GetBool returns the value associated with the key as a boolean.

func (*Viper) GetDuration

func (v *Viper) GetDuration(key string) time.Duration

GetDuration returns the value associated with the key as a duration.

func (*Viper) GetFloat64

func (v *Viper) GetFloat64(key string) float64

GetFloat64 returns the value associated with the key as a float64.

func (*Viper) GetInt

func (v *Viper) GetInt(key string) int

GetInt returns the value associated with the key as an integer.

func (*Viper) GetInt32

func (v *Viper) GetInt32(key string) int32

GetInt32 returns the value associated with the key as an integer.

func (*Viper) GetInt64

func (v *Viper) GetInt64(key string) int64

GetInt64 returns the value associated with the key as an integer.

func (*Viper) GetIntSlice

func (v *Viper) GetIntSlice(key string) []int

GetIntSlice returns the value associated with the key as a slice of int values.

func (*Viper) GetSizeInBytes

func (v *Viper) GetSizeInBytes(key string) uint

GetSizeInBytes wraps viper's method.

func (*Viper) GetString

func (v *Viper) GetString(key string) string

GetString returns the value associated with the key as a string.

func (*Viper) GetStringMap

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

GetStringMap returns the value associated with the key as a map of interfaces.

func (*Viper) GetStringMapInt

func (v *Viper) GetStringMapInt(key string) map[string]int

GetStringMapString returns the value associated with the key as a map of strings.

func (*Viper) GetStringMapString

func (v *Viper) GetStringMapString(key string) map[string]string

GetStringMapString returns the value associated with the key as a map of strings.

func (*Viper) GetStringMapStringSlice

func (v *Viper) GetStringMapStringSlice(key string) map[string][]string

GetStringMapStringSlice returns the value associated with the key as a map to a slice of strings.

func (*Viper) GetStringSlice

func (v *Viper) GetStringSlice(key string) []string

GetStringSlice returns the value associated with the key as a slice of strings.

func (*Viper) GetTime

func (v *Viper) GetTime(key string) time.Time

GetTime returns the value associated with the key as time.

func (*Viper) GetUint

func (v *Viper) GetUint(key string) uint

GetUint returns the value associated with the key as an unsigned integer.

func (*Viper) GetUint32

func (v *Viper) GetUint32(key string) uint32

GetUint32 returns the value associated with the key as an unsigned integer.

func (*Viper) GetUint64

func (v *Viper) GetUint64(key string) uint64

GetUint64 returns the value associated with the key as an unsigned integer.

func (*Viper) InConfig

func (v *Viper) InConfig(key string) bool

InConfig wraps viper's method.

func (*Viper) Instance

func (v *Viper) Instance() *viper.Viper

func (*Viper) IsSet

func (v *Viper) IsSet(key string) bool

IsSet wraps viper's method.

func (*Viper) MergeConfig

func (v *Viper) MergeConfig(in io.Reader) error

MergeConfig wraps viper's method.

func (*Viper) MergeConfigMap

func (v *Viper) MergeConfigMap(cfg map[string]interface{}) error

MergeConfigMap wraps viper's method.

func (*Viper) MergeInConfig

func (v *Viper) MergeInConfig() error

MergeInConfig wraps viper's method.

func (*Viper) ReadConfig

func (v *Viper) ReadConfig(in io.Reader) error

ReadConfig wraps viper's method.

func (*Viper) ReadConfigFile

func (v *Viper) ReadConfigFile(path string) error

ReadConfigFile wraps viper's method.

func (*Viper) ReadRemoteConfig

func (v *Viper) ReadRemoteConfig() error

ReadRemoteConfig wraps viper's method.

func (*Viper) RegisterAlias

func (v *Viper) RegisterAlias(alias string, key string)

RegisterAlias wraps viper's method.

func (*Viper) SafeWriteConfig

func (v *Viper) SafeWriteConfig() error

SafeWriteConfig wraps viper's method.

func (*Viper) SafeWriteConfigAs

func (v *Viper) SafeWriteConfigAs(filename string) error

SafeWriteConfigAs wraps viper's method.

func (*Viper) Set

func (v *Viper) Set(key string, val interface{})

Set wraps viper's method.

func (*Viper) SetConfigType

func (v *Viper) SetConfigType(in string)

SetConfigType sets the type of the configuration returned by the remote source, e.g. "json".

func (*Viper) SetDefault

func (v *Viper) SetDefault(key string, val interface{})

SetDefault wraps viper's method.

func (*Viper) Sub

func (v *Viper) Sub(key string) *Viper

Sub wraps viper's method.

func (*Viper) Unmarshal

func (v *Viper) Unmarshal(rawVal interface{}, opts ...viper.DecoderConfigOption) error

Unmarshal wraps viper's method.

func (*Viper) UnmarshalExact

func (v *Viper) UnmarshalExact(rawVal interface{}, opts ...viper.DecoderConfigOption) error

UnmarshalExact wraps viper's method.

func (*Viper) UnmarshalKey

func (v *Viper) UnmarshalKey(key string, rawVal interface{}, opts ...viper.DecoderConfigOption) error

UnmarshalKey wraps viper's method.

func (*Viper) WatchConfig

func (v *Viper) WatchConfig()

WatchConfig wraps viper's method.

func (*Viper) WatchRemoteConfig

func (v *Viper) WatchRemoteConfig() error

WatchRemoteConfig wraps viper's method.

func (*Viper) WatchRemoteConfigOnChannel

func (v *Viper) WatchRemoteConfigOnChannel() error

WatchRemoteConfigOnChannel wraps viper's method.

func (*Viper) WriteConfig

func (v *Viper) WriteConfig() error

WriteConfig wraps viper's method.

func (*Viper) WriteConfigFile

func (v *Viper) WriteConfigFile(filename string) error

WriteConfigFile wraps viper's method.

Jump to

Keyboard shortcuts

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