config

package
v0.0.0-...-1d9fd85 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 7 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 {
	Server   Server   `yaml:"server"`
	Database Database `yaml:"database"`
	Session  Session  `yaml:"session"`
	Logger   Logger   `yaml:"logging"`
}

func New

func New(configPath string) (*Config, error)

type Database

type Database struct {
	User     string            `yaml:"user"`
	Password string            `yaml:"password"`
	Name     string            `yaml:"name"`
	Protocol string            `yaml:"protocol"`
	Host     string            `yaml:"host"`
	Port     int               `yaml:"port"`
	Params   map[string]string `yaml:"params"`
}

func (Database) DSN

func (db Database) DSN() string

type Flags

type Flags struct {
	YAMLPath string
}

func ParseFlags

func ParseFlags() Flags

type Logger

type Logger struct {
	Writer    string     `yaml:"writer"`
	Handler   string     `yaml:"handler"`
	Level     slog.Level `yaml:"level"`
	AddSource bool       `yaml:"add-source"`
}

type Server

type Server struct {
	Host         string        `yaml:"host"`
	Port         int           `yaml:"port"`
	LogLevel     slog.Level    `yaml:"log-level"`
	IdleTimeout  time.Duration `yaml:"idle-timeout"`
	ReadTimeout  time.Duration `yaml:"read-timeout"`
	WriteTimeout time.Duration `yaml:"write-timeout"`
	CertPath     string        `yaml:"cert-path"`
	KeyPath      string        `yaml:"key-path"`
}

func (Server) Address

func (s Server) Address() string

type Session

type Session struct {
	Lifetime time.Duration `yaml:"lifetime"`
}

Jump to

Keyboard shortcuts

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