Documentation ¶
Index ¶
- type ConfigurationLoader
- func (c *ConfigurationLoader) AddConfigPath(in string)
- func (c *ConfigurationLoader) AutomaticEnv()
- func (c *ConfigurationLoader) ConfigFileUsed() string
- func (c *ConfigurationLoader) GetBool(key string) bool
- func (c *ConfigurationLoader) GetInt(key string) int
- func (c *ConfigurationLoader) GetString(key string) string
- func (c *ConfigurationLoader) GetStringSlice(key string) []string
- func (c *ConfigurationLoader) ReadInConfig() error
- func (c *ConfigurationLoader) SetConfigFile(in string)
- func (c *ConfigurationLoader) SetConfigName(in string)
- func (c *ConfigurationLoader) SetConfigType(in string)
- func (c *ConfigurationLoader) SetDefault(key string, value interface{})
- func (c *ConfigurationLoader) SetEnvKeyReplacer(replacer *strings.Replacer)
- func (c *ConfigurationLoader) SetEnvPrefix(in string)
- func (c *ConfigurationLoader) SetFs(fs afero.Fs)
- type MockConfigurationLoader
- func (c *MockConfigurationLoader) AddConfigPath(in string)
- func (c *MockConfigurationLoader) AutomaticEnv()
- func (c *MockConfigurationLoader) ConfigFileUsed() string
- func (c *MockConfigurationLoader) GetBool(key string) bool
- func (c *MockConfigurationLoader) GetInt(key string) int
- func (c *MockConfigurationLoader) GetString(key string) string
- func (c *MockConfigurationLoader) GetStringSlice(key string) []string
- func (c *MockConfigurationLoader) ReadInConfig() error
- func (c *MockConfigurationLoader) SetConfigFile(in string)
- func (c *MockConfigurationLoader) SetConfigName(in string)
- func (c *MockConfigurationLoader) SetConfigType(in string)
- func (c *MockConfigurationLoader) SetDefault(key string, value interface{})
- func (c *MockConfigurationLoader) SetEnvKeyReplacer(replacer *strings.Replacer)
- func (c *MockConfigurationLoader) SetEnvPrefix(in string)
- func (c *MockConfigurationLoader) SetFs(fs afero.Fs)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigurationLoader ¶
type ConfigurationLoader struct {
// contains filtered or unexported fields
}
func NewConfigurationLoader ¶
func NewConfigurationLoader(viper *viper.Viper) *ConfigurationLoader
func (*ConfigurationLoader) AddConfigPath ¶
func (c *ConfigurationLoader) AddConfigPath(in string)
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 (*ConfigurationLoader) AutomaticEnv ¶
func (c *ConfigurationLoader) AutomaticEnv()
AutomaticEnv has Viper check ENV variables for all. keys set in config, default & flags
func (*ConfigurationLoader) ConfigFileUsed ¶
func (c *ConfigurationLoader) ConfigFileUsed() string
ConfigFileUsed sets the filesystem to use to read configuration
func (*ConfigurationLoader) GetBool ¶
func (c *ConfigurationLoader) GetBool(key string) bool
GetBool returns the value associated with the key as a boolean
func (*ConfigurationLoader) GetInt ¶
func (c *ConfigurationLoader) GetInt(key string) int
GetInt returns the value associated with the key as an integer
func (*ConfigurationLoader) GetString ¶
func (c *ConfigurationLoader) GetString(key string) string
GetString returns the value associated with the key as a string
func (*ConfigurationLoader) GetStringSlice ¶
func (c *ConfigurationLoader) GetStringSlice(key string) []string
GetStringSlice returns the value associated with the key as a slice of strings
func (*ConfigurationLoader) ReadInConfig ¶
func (c *ConfigurationLoader) ReadInConfig() error
ReadInConfig will discover and load the configuration file from disk and key/value stores, searching in one of the defined paths
func (*ConfigurationLoader) SetConfigFile ¶
func (c *ConfigurationLoader) SetConfigFile(in string)
SetConfigFile explicitly defines the path, name and extension of the config file. Viper will use this and not check any of the config paths
func (*ConfigurationLoader) SetConfigName ¶
func (c *ConfigurationLoader) SetConfigName(in string)
SetConfigName sets name for the config file. Does not include extension
func (*ConfigurationLoader) SetConfigType ¶
func (c *ConfigurationLoader) SetConfigType(in string)
SetConfigType sets the type of the configuration returned by the remote source, e.g. "json"
func (*ConfigurationLoader) SetDefault ¶
func (c *ConfigurationLoader) SetDefault(key string, value interface{})
SetDefault sets the default value for this key. SetDefault is case-insensitive for a key. Default only used when no value is provided by the user via flag, config or ENV
func (*ConfigurationLoader) SetEnvKeyReplacer ¶
func (c *ConfigurationLoader) SetEnvKeyReplacer(replacer *strings.Replacer)
SetEnvKeyReplacer
func (*ConfigurationLoader) SetEnvPrefix ¶
func (c *ConfigurationLoader) SetEnvPrefix(in string)
SetEnvPrefix defines a prefix that ENVIRONMENT variables will use. E.g. if your prefix is "spf", the env registry will look for env variables that start with "SPF_"
func (*ConfigurationLoader) SetFs ¶
func (c *ConfigurationLoader) SetFs(fs afero.Fs)
SetFs sets the filesystem to use to read configuration
type MockConfigurationLoader ¶
func NewMockConfigurationLoader ¶
func NewMockConfigurationLoader() *MockConfigurationLoader
func (*MockConfigurationLoader) AddConfigPath ¶
func (c *MockConfigurationLoader) AddConfigPath(in string)
AddConfigPath adds a path for Viper to search for the config file in. Can be called multiple times to define multiple search paths
func (*MockConfigurationLoader) AutomaticEnv ¶
func (c *MockConfigurationLoader) AutomaticEnv()
AutomaticEnv has Viper check ENV variables for all. keys set in config, default & flags
func (*MockConfigurationLoader) ConfigFileUsed ¶
func (c *MockConfigurationLoader) ConfigFileUsed() string
ConfigFileUsed sets the filesystem to use to read configuration
func (*MockConfigurationLoader) GetBool ¶
func (c *MockConfigurationLoader) GetBool(key string) bool
GetBool returns the value associated with the key as a boolean
func (*MockConfigurationLoader) GetInt ¶
func (c *MockConfigurationLoader) GetInt(key string) int
GetInt returns the value associated with the key as an integer
func (*MockConfigurationLoader) GetString ¶
func (c *MockConfigurationLoader) GetString(key string) string
GetString returns the value associated with the key as a string
func (*MockConfigurationLoader) GetStringSlice ¶
func (c *MockConfigurationLoader) GetStringSlice(key string) []string
GetStringSlice returns the value associated with the key as a slice of strings
func (*MockConfigurationLoader) ReadInConfig ¶
func (c *MockConfigurationLoader) ReadInConfig() error
ReadInConfig will discover and load the configuration file from disk and key/value stores, searching in one of the defined paths
func (*MockConfigurationLoader) SetConfigFile ¶
func (c *MockConfigurationLoader) SetConfigFile(in string)
SetConfigFile explicitly defines the path, name and extension of the config file. Viper will use this and not check any of the config paths
func (*MockConfigurationLoader) SetConfigName ¶
func (c *MockConfigurationLoader) SetConfigName(in string)
SetConfigName sets name for the config file. Does not include extension
func (*MockConfigurationLoader) SetConfigType ¶
func (c *MockConfigurationLoader) SetConfigType(in string)
SetConfigType sets the type of the configuration returned by the remote source, e.g. "json"
func (*MockConfigurationLoader) SetDefault ¶
func (c *MockConfigurationLoader) SetDefault(key string, value interface{})
SetDefault sets the default value for this key. SetDefault is case-insensitive for a key. Default only used when no value is provided by the user via flag, config or ENV
func (*MockConfigurationLoader) SetEnvKeyReplacer ¶
func (c *MockConfigurationLoader) SetEnvKeyReplacer(replacer *strings.Replacer)
SetEnvKeyReplacer
func (*MockConfigurationLoader) SetEnvPrefix ¶
func (c *MockConfigurationLoader) SetEnvPrefix(in string)
SetEnvPrefix defines a prefix that ENVIRONMENT variables will use. E.g. if your prefix is "spf", the env registry will look for env variables that start with "SPF_"
func (*MockConfigurationLoader) SetFs ¶
func (c *MockConfigurationLoader) SetFs(fs afero.Fs)
SetFs sets the filesystem to use to read configuration