Documentation
¶
Index ¶
- type Loader
- func (l *Loader) Bool(key string, defaultValue bool) bool
- func (l *Loader) Duration(key string, defaultValue time.Duration) time.Duration
- func (l *Loader) Float64(key string, defaultValue float64) float64
- func (l *Loader) Int(key string, defaultValue int) int
- func (l *Loader) String(key string, defaultValue string) string
- func (l *Loader) Strings(key string, defaultValue []string) []string
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader implements config loader facilities using Viper.
func (*Loader) Bool ¶
Bool returns the boolean value set for the given key. Returns defaultValue if keys is not explicitly set.
func (*Loader) Duration ¶
Duration returns the duration value set for the given key. Returns defaultValue if keys is not explicitly set.
func (*Loader) Float64 ¶
Float64 returns the float64 value set for the given key. Returns defaultValue if keys is not explicitly set.
func (*Loader) Int ¶
Int returns the int value set for the given key. Returns defaultValue if keys is not explicitly set.
type Option ¶
type Option func(l *Loader)
Option values can be provided to Load() for customisation.
func WithCobra ¶
WithCobra enables reading config file overrides from a flag. When the flag is specified, it acts as the only file-based source of configs. If not specified, config files are auto-discovered.
func WithEnvPrefix ¶
WithEnvPrefix sets a prefix to be used for all config variables from environment.
func WithFile ¶
WithFile sets a config file to use explicitly. When the filePath is not empty, it acts the only file-based source of configs. If empty, config files are auto-discovered.