loader

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

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

type MockConfigurationLoader struct {
	mock.Mock
}

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

Jump to

Keyboard shortcuts

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