config

package
v0.0.50-alpha.21 Latest Latest
Warning

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

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

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 ConfigSource

type ConfigSource interface {
	Read() ([]byte, error)
}

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 Loader added in v0.0.47

type Loader struct {
	PathResolver PathResolver
}

Loader is responsible for loading configuration files.

func NewLoader added in v0.0.47

func NewLoader(pathResolver PathResolver) *Loader

func (*Loader) InitConfig added in v0.0.47

func (c *Loader) InitConfig(config any, configName, configFolderPath string) error

type Manager added in v0.0.47

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager added in v0.0.47

func NewManager(parser Parser) *Manager

func (*Manager) AddSource added in v0.0.47

func (cm *Manager) AddSource(source ConfigSource)

func (*Manager) Load added in v0.0.47

func (cm *Manager) Load(config any) error

type Parser added in v0.0.47

type Parser interface {
	Parse(data []byte, out any) error
}

Parser Configures the parser interface.

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 any) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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