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 { type Config struct {
Server ServerConfig Server ServerConfig `mapstructure:"server"`
Database DatabaseConfig Database DatabaseConfig `mapstructure:"database"`
Redis RedisConfig Redis RedisConfig `mapstructure:"redis"`
JWT JWTConfig JWT JWTConfig `mapstructure:"jwt"`
Captcha CaptchaConfig Captcha CaptchaConfig `mapstructure:"captcha"`
} }
type ServerConfig struct { type ServerConfig struct {
Host string Host string `mapstructure:"host"`
Port int Port int `mapstructure:"port"`
Mode string Mode string `mapstructure:"mode"`
} }
type DatabaseConfig struct { type DatabaseConfig struct {
Type string // sqlite or mysql Type string `mapstructure:"type"` // sqlite or mysql
Host string Host string `mapstructure:"host"`
Port int Port int `mapstructure:"port"`
User string User string `mapstructure:"user"`
Password string Password string `mapstructure:"password"`
Database string Database string `mapstructure:"database"`
SQLite SQLiteConfig SQLite SQLiteConfig `mapstructure:"sqlite"`
} }
type SQLiteConfig struct { type SQLiteConfig struct {
Path string Path string `mapstructure:"path"`
} }
type RedisConfig struct { type RedisConfig struct {
Enabled bool Enabled bool `mapstructure:"enabled"`
Host string Host string `mapstructure:"host"`
Port int Port int `mapstructure:"port"`
Password string Password string `mapstructure:"password"`
DB int DB int `mapstructure:"db"`
} }
type JWTConfig struct { type JWTConfig struct {
Secret string Secret string `mapstructure:"secret"`
ExpireTime int // hours ExpireTime int `mapstructure:"expire_time"` // hours
} }
type CaptchaConfig struct { type CaptchaConfig struct {
ModelPath string ModelPath string `mapstructure:"model_path"`
} }
var Cfg *Config var Cfg *Config