config

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package config loads and parses the application's runtime configuration.

Index

Constants

View Source
const (
	LogFormatJSON = "JSON"
	LogFormatText = "TEXT"
)

LogFormat enumerates the allowed values for the LogFormat field.

View Source
const (
	LogLevelTrace = "Trace"
	LogLevelDebug = "Debug"
	LogLevelInfo  = "Info"
	LogLevelWarn  = "Warn"
	LogLevelError = "Error"
	LogLevelFatal = "Fatal"
	LogLevelPanic = "Panic"
)

LogLevel enumerates the allowed values for the LogLevel field.

Variables

View Source
var ErrAlreadyLoaded = rerrors.New("config already loaded")

ErrAlreadyLoaded is returned by Init when the process-wide default config has already been loaded by an earlier call.

Functions

This section is empty.

Types

type Config

type Config struct {
	AppInfo matreshka.AppInfo

	Servers     ServersConfig
	DataSources DataSourcesConfig
	Environment EnvironmentConfig
	Overrides   matreshka.ServiceDiscovery

	MatreshkaConfig matreshka.AppConfig
}

Config is the application's fully parsed runtime configuration.

func Init

func Init() (Config, error)

Init loads the process-wide default config exactly once; every call after the first returns ErrAlreadyLoaded instead of reloading. Safe to call from multiple goroutines.

func Load

func Load(configsPaths ...string) (Config, error)

Load reads and parses configsPaths into a fresh Config on every call. It holds no shared state, so concurrent calls (even with different configsPaths) never race or interfere with one another.

type DataSourcesConfig

type DataSourcesConfig struct {
	Postgres *resources.Postgres
}

DataSourcesConfig holds parsed configuration values for this section.

type EnvironmentConfig

type EnvironmentConfig struct {
	AllowedOrigins       string
	CookieSecure         bool
	CredsEncryptionKey   string
	GoogleAPIKey         string
	GoogleClientID       string
	GoogleClientSecret   string
	LogFormat            string
	LogLevel             string
	NoAuthEnabled        bool
	OtelEndpoint         string
	SubscriptionsEnabled bool
	TelegramClientID     string
}

EnvironmentConfig holds parsed configuration values for this section.

type ServersConfig

type ServersConfig struct {
	MASTER *server.Server
}

ServersConfig holds parsed configuration values for this section.

Jump to

Keyboard shortcuts

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