Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPathResolver ¶
func NewPathResolver() *defaultPathResolver
NewPathResolver creates a new instance of the default path resolver.
Types ¶
type ConfigLoader ¶
type ConfigLoader struct {
PathResolver PathResolver
}
ConfigLoader is responsible for loading configuration files.
func NewConfigLoader ¶
func NewConfigLoader(pathResolver PathResolver) *ConfigLoader
func (*ConfigLoader) InitConfig ¶
func (c *ConfigLoader) InitConfig(config any, configName, configFolderPath string) error
type ConfigManager ¶
type ConfigManager struct {
// contains filtered or unexported fields
}
func NewConfigManager ¶
func NewConfigManager(parser ConfigParser) *ConfigManager
func (*ConfigManager) AddSource ¶
func (cm *ConfigManager) AddSource(source ConfigSource)
func (*ConfigManager) Load ¶
func (cm *ConfigManager) Load(config interface{}) error
type ConfigParser ¶
ConfigParser Configures the parser interface
type ConfigSource ¶
ConfigSource configuring source interfaces
type EnvVarSource ¶
type EnvVarSource struct {
VarName string
}
EnvVarSource read a configuration from an environment variable
func (*EnvVarSource) Read ¶
func (e *EnvVarSource) Read() ([]byte, error)
type FileSystemSource ¶
type FileSystemSource struct {
FilePath string
}
FileSystemSource read a configuration from a file
func (*FileSystemSource) Read ¶
func (f *FileSystemSource) Read() ([]byte, error)
type PathResolver ¶
type PathResolver interface { GetDefaultConfigPath() (string, error) GetProjectRoot() (string, error) }
PathResolver defines methods for resolving paths related to the application.
type YAMLParser ¶
type YAMLParser struct{}
YAMLParser Configuration parser in YAML format
func (*YAMLParser) Parse ¶
func (y *YAMLParser) Parse(data []byte, out interface{}) error
Click to show internal directories.
Click to hide internal directories.