Help us shape the future of Go! Take the 2026 Go Developer Survey

loader

package
v0.112.18 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 52 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadDatabaseConfigFile

func LoadDatabaseConfigFile(files ...[]byte) (*database.ConfigFile, error)

LoadDatabaseConfigFile loads the database config file via viper

func LoadServerConfigFile

func LoadServerConfigFile(files ...[]byte) (*server.ServerConfigFile, error)

LoadServerConfigFile loads the server config file via viper

Types

type ConfigLoader

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

func NewConfigLoader

func NewConfigLoader(directory string, opts ...ConfigLoaderOpt) *ConfigLoader

NewConfigLoader creates a ConfigLoader that reads server and database configuration from the given directory, applying any options.

func (*ConfigLoader) CreateServerFromConfig

func (c *ConfigLoader) CreateServerFromConfig(version string, overrides ...ServerConfigFileOverride) (cleanup func() error, res *server.ServerConfig, err error)

CreateServerFromConfig loads the server configuration and returns a server

func (*ConfigLoader) InitDataLayer

func (c *ConfigLoader) InitDataLayer() (res *database.Layer, err error)

InitDataLayer initializes the database layer from the configuration

type ConfigLoaderOpt added in v0.106.11

type ConfigLoaderOpt func(*ConfigLoader)

ConfigLoaderOpt configures a ConfigLoader created by NewConfigLoader.

func WithLogWriter added in v0.106.11

func WithLogWriter(w io.Writer) ConfigLoaderOpt

WithLogWriter routes the loggers this loader constructs (database, server and the additional per-service loggers) to w instead of os.Stderr. This is a runtime-only override intended for embedding callers; it cannot be expressed in a config file. Explicit writers set by a ServerConfigFileOverride take precedence over w.

The loader hands the same writer to several independent loggers that log concurrently, so w is wrapped in a mutex-guarded writer here; callers can pass writers that are not safe for concurrent use, such as a bytes.Buffer.

type ServerConfigFileOverride

type ServerConfigFileOverride func(*server.ServerConfigFile)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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