Documentation
¶
Index ¶
- Variables
- type Option
- type Settings
- func (s *Settings) AddConfigPath(path string)
- func (s *Settings) AllKeys() []string
- func (s *Settings) AllSettings() map[string]any
- func (s *Settings) AutomaticEnv()
- func (s *Settings) Get(key string) any
- func (s *Settings) GetBool(key string) bool
- func (s *Settings) GetDuration(key string) time.Duration
- func (s *Settings) GetFloat64(key string) float64
- func (s *Settings) GetInt(key string) int
- func (s *Settings) GetInt32(key string) int32
- func (s *Settings) GetInt64(key string) int64
- func (s *Settings) GetString(key string) string
- func (s *Settings) GetStringMap(key string) map[string]any
- func (s *Settings) GetStringMapString(key string) map[string]string
- func (s *Settings) GetStringMapStringSlice(key string) map[string][]string
- func (s *Settings) GetStringSlice(key string) []string
- func (s *Settings) GetTime(key string) time.Time
- func (s *Settings) GetUint(key string) uint
- func (s *Settings) GetUint32(key string) uint32
- func (s *Settings) GetUint64(key string) uint64
- func (s *Settings) ReadInConfig() error
- func (s *Settings) Set(key string, value any)
- func (s *Settings) SetConfigName(name string)
- func (s *Settings) SetDefault(key string, value any)
- func (s *Settings) SetFromFile(configFileName string, configSearchPaths ...string) error
- func (s *Settings) Unmarshal(v any) error
- func (s *Settings) WatchConfig()
- func (s *Settings) WriteConfig(filename string) error
- type StringReplacer
Constants ¶
This section is empty.
Variables ¶
var ( KeyDelimiter = viper.KeyDelimiter EnvKeyReplacer = viper.EnvKeyReplacer )
Functions ¶
This section is empty.
Types ¶
type Settings ¶
type Settings struct {
// contains filtered or unexported fields
}
Settings is a prioritized configuration registry. It maintains a set of configuration sources, fetches values to populate those, and provides them according to the source's priority. The priority of the sources is the following: 1. overrides 2. flags 3. env. variables 4. config file 5. key/value store 6. defaults
func (*Settings) AddConfigPath ¶
AddConfigPath adds a path for Viper to search for the config file in. Can be called multiple times to define multiple search paths.
func (*Settings) AllSettings ¶
func (*Settings) AutomaticEnv ¶
func (s *Settings) AutomaticEnv()
AutomaticEnv makes Settings check if environment variables match any of the existing keys (config, default or flags). If matching env vars are found, they are loaded into Viper.
func (*Settings) GetFloat64 ¶
func (*Settings) GetStringMapString ¶
func (*Settings) GetStringMapStringSlice ¶
func (*Settings) GetStringSlice ¶
func (*Settings) ReadInConfig ¶
ReadInConfig will discover and load the configuration file from disk and key/value stores, searching in one of the defined paths.
func (*Settings) SetConfigName ¶
SetConfigName sets name for the config file. Does not include extension.
func (*Settings) SetDefault ¶
func (*Settings) SetFromFile ¶
func (*Settings) WatchConfig ¶
func (s *Settings) WatchConfig()
WatchConfig starts watching a config file for changes.
func (*Settings) WriteConfig ¶
WriteConfig writes the current configuration to a given filename.
type StringReplacer ¶
type StringReplacer = viper.StringReplacer