Files
workspace/code/allapp/allapp-go-v3/internal/config/config.go
T
2026-04-19 21:30:51 +08:00

55 lines
1.7 KiB
Go

package config
import "time"
type Config struct {
App AppConfig `mapstructure:"app"`
JWT JwtConfig `mapstructure:"jwt"`
UniqueID UniqueIDConfig `mapstructure:"unique_id"`
Postgres PostgresConfig `mapstructure:"postgres"`
Wechat WechatConfig `mapstructure:"wechat"`
AwsS3 AwsS3Config `mapstructure:"aws_s3"`
}
type AppConfig struct {
Name string `mapstructure:"name"`
Port int `mapstructure:"port"`
BaseUrl string `mapstructure:"base_url"`
}
type PostgresConfig struct {
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
User string `mapstructure:"user"`
Password string `mapstructure:"password"`
Dbname string `mapstructure:"dbname"`
SslMode bool `mapstructure:"ssl_mode"`
TimeZone string `mapstructure:"timezone"`
MaxOpenConns int32 `mapstructure:"max_open_conns"`
MaxIdleConns int32 `mapstructure:"max_idle_conns"`
ConnMaxLifetime time.Duration `mapstructure:"conn_max_lifetime"`
}
type JwtConfig struct {
Secret string `mapstructure:"secret"`
AccessExpiry time.Duration `mapstructure:"access_expiry"`
}
type UniqueIDConfig struct {
DataCenterID uint16 `mapstructure:"datacenter_id"`
WorkerID uint16 `mapstructure:"worker_id"`
}
type WechatConfig struct {
AppId string `mapstructure:"app_id"`
AppSecret string `mapstructure:"app_secret"`
}
type AwsS3Config struct {
Region string `mapstructure:"region"`
AccessKey string `mapstructure:"access_key"`
SecretKey string `mapstructure:"secret_key"`
Bucket string `mapstructure:"bucket"`
Endpoint string `mapstructure:"endpoint"`
}