loader

package
v0.0.0-...-37b9b4a Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToLoadConfig   = errors.New("failed to load config")
	ErrNoSourceProvided     = errors.New("no source provided to loader")
	ErrUnsupportedExtension = errors.New("unsupported file extension")
)

Functions

func NewTomlLoader

func NewTomlLoader(source []byte) *tomlLoader

NewTomlLoader creates a new TOML configuration loader

Types

type Loader

type Loader interface {
	// LoadProto parses configuration and returns the Protocol Buffer config
	LoadProto() (*pbSettings.ServerConfig, error)
	// GetProtoConfig returns the underlying Protocol Buffer configuration
	GetProtoConfig() *pbSettings.ServerConfig
}

Loader handles loading configuration from various sources

func NewLoaderFromBytes

func NewLoaderFromBytes(data []byte, lodFunc LoaderFunc) (Loader, error)

NewLoaderFromBytes creates a new Loader with the provided bytes

func NewLoaderFromFilePath

func NewLoaderFromFilePath(filePath string) (Loader, error)

NewLoaderFromFilePath creates a new Loader from a file path

func NewLoaderFromReader

func NewLoaderFromReader(reader io.Reader, lodFunc LoaderFunc) (Loader, error)

NewLoaderFromReader creates a new Loader from an io.Reader

type LoaderFunc

type LoaderFunc func([]byte) Loader

Jump to

Keyboard shortcuts

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