config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Env      string `yaml:"env"`
	Project  string `yaml:"project"`
	Timezone string `yaml:"timezone"`
}

type Cache

type Cache struct {
	Disabled   bool            `yaml:"disabled"`
	DBName     string          `yaml:"dbname"`
	Port       int             `yaml:"port"`
	Address    string          `yaml:"address"`
	Credential CacheCredential `yaml:"credential"`
	Options    CacheOption     `yaml:"options"`
}

type CacheCredential

type CacheCredential struct {
	Enabled  bool   `yaml:"enabled"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

type CacheOption added in v0.2.0

type CacheOption struct {
	DialTimeout  int `yaml:"dial.timeout"`
	ReadTimeout  int `yaml:"read.timeout"`
	WriteTimeout int `yaml:"write.timeout"`
}

type Cfg

type Cfg struct {
	App      App                 `yaml:"app"`
	Otel     Otel                `yaml:"otel"`
	Server   map[string]Server   `yaml:"server"`
	SMTP     map[string]SMTP     `yaml:"smtp"`
	Template map[string]string   `yaml:"template"`
	DB       map[string]DB       `yaml:"db"`
	Cache    map[string]Cache    `yaml:"cache"`
	Log      Log                 `yaml:"log"`
	Provider map[string]Provider `yaml:"provider"`
	Security Security            `yaml:"security"`
}

func ProvideConfig

func ProvideConfig() (Cfg, error)

type DB

type DB struct {
	Disabled   bool         `yaml:"disabled"`
	Driver     string       `yaml:"driver"`
	DBName     string       `yaml:"dbname"`
	Port       int          `yaml:"port"`
	Address    string       `yaml:"address"`
	Credential DBCredential `yaml:"credential"`
	Options    DBOptions    `yaml:"options"`
}

type DBCredential

type DBCredential struct {
	Enabled  bool   `yaml:"enabled"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

type DBOptions

type DBOptions struct {
	Timezone              string `yaml:"timezone"`
	Sslmode               string `yaml:"sslmode"`
	ConnectionTimeout     int    `yaml:"connection.timeout"`
	MaxConnectionLifetime int    `yaml:"max.connection.lifetime"`
	MaxOpenConnection     int    `yaml:"max.open.connection"`
	MaxIdleConnection     int    `yaml:"max.idle.connection"`
}

type Log

type Log struct {
	BasePath  string             `yaml:"base.path"`
	TrxClient []string           `yaml:"trx.client"`
	LogType   map[string]LogType `yaml:"log.type"`
}

type LogConsole

type LogConsole struct {
	Disabled bool `yaml:"disabled"`
	Level    int  `yaml:"level"`
}

type LogFile

type LogFile struct {
	Disabled bool        `yaml:"disabled"`
	Level    int         `yaml:"level"`
	Rotation LogRotation `yaml:"rotation"`
}

type LogNotify added in v0.2.0

type LogNotify struct {
	Enabled   bool `yaml:"enabled"`
	Debug     bool `yaml:"debug"`
	Retention int  `yaml:"retention"`
}

type LogOtel added in v0.5.0

type LogOtel struct {
	Disabled bool `yaml:"disabled"`
	Level    int  `yaml:"level"`
}

type LogRotation

type LogRotation struct {
	Filename  string `yaml:"filename"`
	MaxBackup int    `yaml:"max.backup"`
	MaxSize   int    `yaml:"max.size"`
	MaxAge    int    `yaml:"max.age"`
	LocalTime bool   `yaml:"local.time"`
	Compress  bool   `yaml:"compress"`
}

type LogType added in v0.3.1

type LogType struct {
	Disabled bool       `yaml:"disabled"`
	Notify   LogNotify  `yaml:"notify"`
	Otel     LogOtel    `yaml:"otel"`
	Console  LogConsole `yaml:"console"`
	File     LogFile    `yaml:"file"`
}

type Otel added in v0.4.0

type Otel struct {
	Tracer  bool        `yaml:"tracer"`
	Metric  bool        `yaml:"metric"`
	Logs    bool        `yaml:"logs"`
	Server  OtelServer  `yaml:"server"`
	Options OtelOptions `yaml:"options"`
}

type OtelLogOptions added in v1.0.0

type OtelLogOptions struct {
	IgnoreAttrKey map[string][]string `yaml:"ignore.attr.keys"` // key map is group name
}

type OtelOptions added in v1.0.0

type OtelOptions struct {
	Logs OtelLogOptions `yaml:"logs"`
}

type OtelServer added in v0.4.0

type OtelServer struct {
	GrpcHost string `yaml:"grpc.host"`
	GrpcPort int    `yaml:"grpc.port"`
}

type Provider added in v0.3.0

type Provider struct {
	BaseUrl string            `yaml:"base.url"`
	Options map[string]string `yaml:"options"`
}

type SMTP

type SMTP struct {
	Host       string         `yaml:"host"`
	Port       int            `yaml:"port"`
	Credential SMTPCredential `yaml:"credential"`
}

type SMTPCredential

type SMTPCredential struct {
	Name     string `yaml:"name"`
	Email    string `yaml:"email"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

type Security added in v1.0.0

type Security struct {
	AESKey map[string]string `yaml:"aes.key"`
}

type Server

type Server struct {
	Name       string            `yaml:"name"`
	Host       string            `yaml:"host"`
	Port       int               `yaml:"port"`
	Address    string            `yaml:"address"`
	Domain     string            `yaml:"domain"`
	Additional map[string]string `yaml:"additional"`
}

Jump to

Keyboard shortcuts

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