config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig() (*Config, *ConfigError)

Load configuration from file or environment variables Parse for stdin Return the configuration struct

func LogFilePath

func LogFilePath(filePath string) (*os.File, error)

LogFilePath opens the log file for writing, or returns stdout if "stdout" is specified

func ParseLogLevel

func ParseLogLevel(level string) slog.Level

ParseLogLevel converts a string log level to slog.Level

Types

type Config

type Config struct {
	HttpServer ServerConfig
	Log        LogConfig
	O11        O11Config
	JWT        JWTConfig
}

type ConfigError

type ConfigError struct {
	Message        string
	AppendedErrors []error
}

func (*ConfigError) Error

func (ce *ConfigError) Error() string

Error implements the error interface for ConfigError It formats all validation errors into a single error message

type JWTConfig

type JWTConfig struct {
	PublicKeyPath  string
	PrivateKeyPath string
	PublicKey      *rsa.PublicKey
	PrivateKey     *rsa.PrivateKey
}

func (*JWTConfig) LoadKeys

func (j *JWTConfig) LoadKeys() error

LoadKeys loads the public and private keys from files

type LogConfig

type LogConfig struct {
	Level    string
	FilePath string
}

type O11Config

type O11Config struct {
	TracerEndpoint string
	PrometheusPath string
}

func (*O11Config) Validate

func (c *O11Config) Validate() error

Validate checks if the o11 configuration is valid.

type ServerConfig

type ServerConfig struct {
	Address      string
	Port         int
	Timeout      int
	ReadTimeout  int
	WriteTimeout int
}

Jump to

Keyboard shortcuts

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