Documentation
¶
Overview ¶
Package viper provides utilities to work with `github.com/spf13/viper`
Index ¶
- func BindFlags(cmd *cobra.Command, params []cli.Param, vp *lib.Viper) error
- type Config
- func (c *Config) FileUsed() string
- func (c *Config) Get(key string) interface{}
- func (c *Config) Internals() *lib.Viper
- func (c *Config) IsSet(key string) bool
- func (c *Config) Read(src io.Reader) error
- func (c *Config) ReadFile(ignoreNotFound bool) error
- func (c *Config) Set(key string, value interface{})
- func (c *Config) Unmarshal(receiver interface{}, key string) error
- type ConfigOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config provides a simple interface to manage application settings using Viper.
func ConfigHandler ¶
func ConfigHandler(app string, opts *ConfigOptions) *Config
ConfigHandler returns a new configuration management instance configured for the provided `app` identifier. Optional locations can be provided to specify valid paths to look for a config file.
func (*Config) FileUsed ¶
FileUsed returns the full path of the configuration file used to load the settings.
func (*Config) Internals ¶
Internals expose the private viper instance used by the configuration manager; use with care.
func (*Config) ReadFile ¶
ReadFile will try to load configuration values from the local filesystem; optionally ignore the error produced when no configuration file was found.
type ConfigOptions ¶
type ConfigOptions struct { // Configuration file name (without extension). Defaults to `config`. FileName string // Configuration file extension. This will be used internally to automatically // decode its contents accordingly. Defaults to `yaml` FileType string // Additional locations to look for the configuration file. Locations []string }
ConfigOptions adjust the internal behavior of the configuration handler.