fix: add mapstructure tags to config structs for proper viper parsing
Build and Deploy / build (push) Successful in 2m39s
Build and Deploy / deploy (push) Successful in 9s

This commit is contained in:
2026-07-17 07:51:57 +00:00
parent 16e2f649b1
commit d9cc4b0be0
+24 -24
View File
@@ -8,48 +8,48 @@ import (
)
type Config struct {
Server ServerConfig
Database DatabaseConfig
Redis RedisConfig
JWT JWTConfig
Captcha CaptchaConfig
Server ServerConfig `mapstructure:"server"`
Database DatabaseConfig `mapstructure:"database"`
Redis RedisConfig `mapstructure:"redis"`
JWT JWTConfig `mapstructure:"jwt"`
Captcha CaptchaConfig `mapstructure:"captcha"`
}
type ServerConfig struct {
Host string
Port int
Mode string
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
Mode string `mapstructure:"mode"`
}
type DatabaseConfig struct {
Type string // sqlite or mysql
Host string
Port int
User string
Password string
Database string
SQLite SQLiteConfig
Type string `mapstructure:"type"` // sqlite or mysql
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
User string `mapstructure:"user"`
Password string `mapstructure:"password"`
Database string `mapstructure:"database"`
SQLite SQLiteConfig `mapstructure:"sqlite"`
}
type SQLiteConfig struct {
Path string
Path string `mapstructure:"path"`
}
type RedisConfig struct {
Enabled bool
Host string
Port int
Password string
DB int
Enabled bool `mapstructure:"enabled"`
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
Password string `mapstructure:"password"`
DB int `mapstructure:"db"`
}
type JWTConfig struct {
Secret string
ExpireTime int // hours
Secret string `mapstructure:"secret"`
ExpireTime int `mapstructure:"expire_time"` // hours
}
type CaptchaConfig struct {
ModelPath string
ModelPath string `mapstructure:"model_path"`
}
var Cfg *Config