Documentation ¶
Index ¶
- type EnvVarNotFoundError
- type Envi
- func (envi *Envi) EnsureVars(requiredVars ...string) error
- func (envi *Envi) FromMap(vars map[string]string)
- func (envi *Envi) LoadAndWatchJSONFile(path string, callback ...func() error) (error, func() error, <-chan error)
- func (envi *Envi) LoadAndWatchYAMLFile(path string, callbacks ...func() error) (error, func() error, <-chan error)
- func (envi *Envi) LoadEnv(vars ...string)
- func (envi *Envi) LoadFile(key, filePath string) error
- func (envi *Envi) LoadFileFromEnvPath(key string, envPath string) error
- func (envi *Envi) LoadJSON(blobs ...[]byte) error
- func (envi *Envi) LoadJSONFile(path string) error
- func (envi *Envi) LoadJSONFiles(paths ...string) error
- func (envi *Envi) LoadJSONFilesFromEnvPaths(vars ...string) error
- func (envi *Envi) LoadYAML(blobs ...[]byte) error
- func (envi *Envi) LoadYAMLFile(path string) error
- func (envi *Envi) LoadYAMLFiles(paths ...string) error
- func (envi *Envi) LoadYAMLFilesFromEnvPaths(vars ...string) error
- func (envi *Envi) ToEnv()
- func (envi *Envi) ToMap() map[string]string
- type FailedToReadFileError
- type RequiredEnvVarsMissing
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EnvVarNotFoundError ¶ added in v2.1.0
type EnvVarNotFoundError struct {
// contains filtered or unexported fields
}
EnvVarNotFoundError says, that a given Environment Variable is not found.
func (*EnvVarNotFoundError) Error ¶ added in v2.1.0
func (e *EnvVarNotFoundError) Error() string
Error implements the error interface.
type Envi ¶
type Envi struct {
// contains filtered or unexported fields
}
Envi is a config loader to load all sorts of configuration files.
func (*Envi) EnsureVars ¶
EnsureVars checks, if all given keys have a non-empty value.
func (*Envi) LoadAndWatchJSONFile ¶ added in v2.2.0
func (envi *Envi) LoadAndWatchJSONFile(path string, callback ...func() error) (error, func() error, <-chan error)
LoadAndWatchJSONFile loads key-value pairs from a json file, then watches that file and reloads it when it changes. Accepts optional callback functions that are executed after the file was reloaded. Returns and error when something goes wrong. When no error is returned, returns a close function that should be deferred in the calling function, and an error channel where errors that occur during the file watching get sent.
func (*Envi) LoadAndWatchYAMLFile ¶ added in v2.2.0
func (envi *Envi) LoadAndWatchYAMLFile(path string, callbacks ...func() error) (error, func() error, <-chan error)
LoadAndWatchYAMLFile loads key-value pairs from a yaml file, then watches that file and reloads it when it changes. Accepts optional callback functions that are executed after the file was reloaded. Returns and error when something goes wrong. When no error is returned, returns a close function that should be deferred in the calling function, and an error channel where errors that occur during the file watching get sent.
func (*Envi) LoadFileFromEnvPath ¶ added in v2.1.0
LoadYAMLFilesFromEnvPaths loads the file content from the path in the given environment variable to the value of the given key.
func (*Envi) LoadJSONFile ¶ added in v2.1.0
LoadJSONFile loads key-value pairs from a json file.
func (*Envi) LoadJSONFiles ¶
LoadJSONFiles loads key-value pairs from one or more json files.
func (*Envi) LoadJSONFilesFromEnvPaths ¶ added in v2.1.0
LoadYAMLFilesFromEnvPaths loads json files from the paths in the given environment variables.
func (*Envi) LoadYAMLFile ¶ added in v2.1.0
LoadYAMLFile loads key-value pairs from a yaml file.
func (*Envi) LoadYAMLFiles ¶
LoadYAMLFiles loads key-value pairs from one or more yaml files.
func (*Envi) LoadYAMLFilesFromEnvPaths ¶ added in v2.1.0
LoadYAMLFilesFromEnvPaths loads yaml files from the paths in the given environment variables.
type FailedToReadFileError ¶ added in v2.1.0
type FailedToReadFileError struct {
// contains filtered or unexported fields
}
FailedToReadFileError says, that a given file could not be read.
func (*FailedToReadFileError) Error ¶ added in v2.1.0
func (e *FailedToReadFileError) Error() string
Error implements the error interface.
type RequiredEnvVarsMissing ¶
type RequiredEnvVarsMissing struct {
MissingVars []string
}
RequiredEnvVarsMissing says, that a required Environment Variable is not given.
func (*RequiredEnvVarsMissing) Error ¶
func (e *RequiredEnvVarsMissing) Error() string