This commit is contained in:
Vladislav Kunetskiy
2026-10-16 16:39:00 +03:00
parent 4e84354642
commit 1ed57cd49f
98 changed files with 6574 additions and 449 deletions
+15 -7
View File
@@ -28,19 +28,26 @@ const (
)
type Config struct {
Env string `mapstructure:"env" validate:"omitempty,eq=dev"`
Server Server `mapstructure:"server"`
Log Log `mapstructure:"log"`
Postgres Postgres `mapstructure:"postgres"`
Redis Redis `mapstructure:"redis"`
Cache Cache `mapstructure:"cache"`
Session Session `mapstructure:"session"`
Env string `mapstructure:"env" validate:"omitempty,eq=dev"`
Server Server `mapstructure:"server"`
Log Log `mapstructure:"log"`
Postgres Postgres `mapstructure:"postgres"`
Redis Redis `mapstructure:"redis"`
Cache Cache `mapstructure:"cache"`
Session Session `mapstructure:"session"`
Idempotency Idempotency `mapstructure:"idempotency"`
}
type Session struct {
TTLSeconds int `mapstructure:"ttl_seconds" validate:"required,gt=0"`
}
// Idempotency holds the retention window of a message Idempotency-Key (contract
// 1.3.0 requires at least 24 hours).
type Idempotency struct {
TTLSeconds int `mapstructure:"ttl_seconds" validate:"required,gt=0"`
}
type Redis struct {
Enabled bool `mapstructure:"enabled"`
Host string `mapstructure:"host" validate:"omitempty,hostname|ip"`
@@ -117,6 +124,7 @@ var defaults = map[string]any{
"log.level": "info",
"log.format": "json",
"session.ttl_seconds": 3600,
"idempotency.ttl_seconds": 86400,
"redis.enabled": false,
"redis.host": "localhost",
"redis.port": 6379,