Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnsupportedFileFormat = errors.New("unsupported file format")
Functions ¶
Types ¶
type Loader ¶
type Loader struct {
FileSuffix []string
Folders []string
Decoders map[string]Decoder
CheckCurrentFolder bool
CheckEnv bool
MapDecoder func(data any, to any) error
}
func (Loader) Load ¶ added in v0.4.0
Load loads the configuration from the file.
- first it checks the current directory after that it checks the etc folder.
- CONFIG_PATH environment variable is used to determine the file path.
func (*Loader) LoadName ¶ added in v0.4.0
func (l *Loader) LoadName() loader.LoaderName
type Option ¶
type Option func(*option)
func WithCheckCurrentFolder ¶ added in v0.4.0
WithCheckCurrentFolder enables loading configuration from the current folder.
- default is true
func WithCheckEnv ¶ added in v0.4.0
WithCheckEnv enables loading configuration from the path specified in CONFIG_PATH environment variable.
- default is true
func WithDecoders ¶
WithDecoders sets the decoders to use when loading the configuration.
- order matters
func WithFileSuffix ¶
WithFileSuffix sets the file suffixes to use when loading the configuration.
- order matters
func WithFolders ¶
WithFolders sets the folders to use when loading the configuration.
- order matters
- default is /etc
Click to show internal directories.
Click to hide internal directories.