config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	HTTP HTTPConfig     `envPrefix:"HTTP_"`
	Seed SeedConfig     `envPrefix:"SEED_"`
	DB   DatabaseConfig `envPrefix:"DB_"`
}

Config is loaded before DI construction and server startup.

func Load

func Load(env pfw.Environment) (Config, error)

func (Config) Validate

func (c Config) Validate() error

func (Config) ValidateEnvironment

func (c Config) ValidateEnvironment(env pfw.Environment) error

type DatabaseConfig

type DatabaseConfig struct {
	DSN            string        `env:"DSN"`
	ConnectTimeout time.Duration `env:"CONNECT_TIMEOUT" envDefault:"5s"`
}

type HTTPConfig

type HTTPConfig struct {
	Address           string        `env:"ADDRESS" envDefault:":8080"`
	ReadHeaderTimeout time.Duration `env:"READ_HEADER_TIMEOUT" envDefault:"5s"`
	ShutdownTimeout   time.Duration `env:"SHUTDOWN_TIMEOUT" envDefault:"5s"`
}

type SeedConfig

type SeedConfig struct {
	UserName string `env:"USER_NAME" envDefault:"Ada"`
}

Jump to

Keyboard shortcuts

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