config

package
v0.0.0-...-71eb8d2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module("config",
	fx.Provide(func(v *viper.Viper, zl zerolog.Logger) (*Config, error) {
		config, err := LoadConfig(v)
		if err != nil {
			zl.Error().Err(err).Msg("failed to load config")
			return nil, err
		}
		zl.Info().Interface("config", config).Msg("loaded config")
		return config, nil
	}),
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Database  Database  `mapstructure:"database"`
	Nats      Nats      `mapstructure:"nats"`
	Log       Log       `mapstructure:"log"`
	Handler   Handler   `mapstructure:"handler"`
	Processor Processor `mapstructure:"processor"`
	View      View      `mapstructure:"view"`
}

func LoadConfig

func LoadConfig(v *viper.Viper) (*Config, error)

func (Config) MarshalZerologObject

func (c Config) MarshalZerologObject(e *zerolog.Event)

type Database

type Database struct {
	DSN  string `mapstructure:"dsn" validate:"omitempty,url"`
	Name string `mapstructure:"name" validate:""`
}

type Handler

type Handler struct {
	Port int `mapstructure:"port" validate:"omitempty,gte=80,lte=65535"`
}

type Log

type Log struct {
	Level   string `mapstructure:"level" validate:"oneof=trace debug info warn error"`
	Console bool   `mapstructure:"console"`
}

type Nats

type Nats struct {
	URL string `mapstructure:"url" validate:"required,url"`
}

type Processor

type Processor struct {
	Port int `mapstructure:"port" validate:"omitempty,gte=80,lte=65535"`
}

type View

type View struct {
	Port int `mapstructure:"port" validate:"omitempty,gte=80,lte=65535"`
}

Jump to

Keyboard shortcuts

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