qnc-server-old/config/config.go
2024-09-14 10:48:09 +08:00

130 lines
5.4 KiB
Go

package config
import "time"
var ConfigData Config
type Config struct {
JWT JWTConfig `mapstructure:"jwt"`
Server ServerConfig `mapstructure:"server"`
Database DatabaseConfig `mapstructure:"database"`
System System `mapstructure:"system"`
Antifraud AntifraudConfig `mapstructure:"antifraud"`
VerifyCode VerifyCodeConfig `mapstructure:"verifycode"`
Redis Redis `mapstructure:"redis"`
LawsuitQuery LawsuitQueryConfig `mapstructure:"lawsuitquery"`
TycOpen TycOpen `mapstructure:"tyc-open"`
WxPay WxPayConfig `mapstructure:"wx-pay"`
AliPay AliPayConfig `mapstructure:"ali-pay"`
Car CarConfig `mapstructure:"car"`
YuShan YuShanConfig `mapstructure:"yushan"`
Robot Robot `mapstructure:"robot"`
Notify Notify `mapstructure:"notify"`
Verify Verify `mapstructure:"verify"`
Setting Setting `mapstructure:"setting"`
}
type JWTConfig struct {
SigningKey string `mapstructure:"signing-key"`
ExpiresTime string `mapstructure:"expires-time"`
BufferTime string `mapstructure:"buffer-time"`
Issuer string `mapstructure:"issuer"`
}
type ServerConfig struct {
Domain string `mapstructure:"domain"`
HttpsPort int `mapstructure:"https-port"`
HttpPort int `mapstructure:"http-port"`
Prefix string `mapstructure:"prefix"`
}
type DatabaseConfig struct {
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
DBName string `mapstructure:"dbname"`
}
type System struct {
StartingUserId uint `mapstructure:"starting-user-id"`
WxLoginUrl string `mapstructure:"wx-login-url" json:"wx-login-url" yaml:"wx-login-url"`
WxAppId string `mapstructure:"wx-appid" json:"wx-appid" yaml:"wx-appid"`
WxSecret string `mapstructure:"wx-secret" json:"wx-secret" yaml:"wx-secret"`
WxH5LoginUrl string `mapstructure:"wx-h5-login-url" json:"wx-h5-login-url" yaml:"wx-h5-login-url"`
WxH5UserinfoUrl string `mapstructure:"wx-h5-userinfo-url" json:"wx-h5-userinfo-url" yaml:"wx-h5-userinfo-url"`
WxH5AppId string `mapstructure:"wx-h5-appid" json:"wx-h5-appid" yaml:"wx-h5-appid"`
WxH5Secret string `mapstructure:"wx-h5-secret" json:"wx-h5-secret" yaml:"wx-h5-secret"`
}
type AntifraudConfig struct {
ApiKey string `mapstructure:"api-key"`
AcctId string `mapstructure:"acct-id"`
HttpUrl string `mapstructure:"http-url"`
}
type CarConfig struct {
ApiKey string `mapstructure:"api-key"`
AcctId string `mapstructure:"acct-id"`
HttpUrl string `mapstructure:"http-url"`
Callback string `mapstructure:"callback"`
}
type YuShanConfig struct {
ApiKey string `mapstructure:"api-key"`
AcctId string `mapstructure:"acct-id"`
HttpUrl string `mapstructure:"http-url"`
}
type VerifyCodeConfig struct {
AccessKeyID string `mapstructure:"access-key-id"`
AccessKeySecret string `mapstructure:"access-key-secret"`
EndpointURL string `mapstructure:"endpoint-url"`
SignName string `mapstructure:"sign-name"`
TemplateCode string `mapstructure:"template-code"`
MarriageTemplateCode string `mapstructure:"marriage-template-code"`
Expiration time.Duration `mapstructure:"expiration"`
ThrottleTime time.Duration `mapstructure:"throttle-time"`
}
type Redis struct {
Addr string `mapstructure:"addr" json:"addr" yaml:"addr"` // 服务器地址:端口
Password string `mapstructure:"password" json:"password" yaml:"password"` // 密码
DB int `mapstructure:"db" json:"db" yaml:"db"` // 单实例模式下redis的哪个数据库
}
type LawsuitQueryConfig struct {
ListURL string `mapstructure:"list-url"`
SxrURL string `mapstructure:"sxr-url"`
LimitHightURL string `mapstructure:"limit-hight-url"`
AppCode string `mapstructure:"appcode"`
}
type TycOpen struct {
Url string `mapstructure:"url"`
Token string `mapstructure:"token"`
}
type WxPayConfig struct {
MchID string `mapstructure:"mch-id"`
MchCertificateSerialNumber string `mapstructure:"mch-certificate-serial-number"`
MchAPIv3Key string `mapstructure:"mch-apiv3-key"`
MchH5ID string `mapstructure:"mch-h5-id"`
MchH5CertificateSerialNumber string `mapstructure:"mch-h5-certificate-serial-number"`
MchH5APIv3Key string `mapstructure:"mch-h5-apiv3-key"`
NotifyURL string `mapstructure:"notify-url"`
RefundNotifyURL string `mapstructure:"refund-notify-url"`
}
type AliPayConfig struct {
AppID string `mapstructure:"appid"`
NotifyURL string `mapstructure:"notify-url"`
PrivateKey string `mapstructure:"private-key"`
PublicKey string `mapstructure:"public-key"`
}
type Robot struct {
Addr string `mapstructure:"addr"`
Webhook string `mapstructure:"webhook"`
}
type Notify struct {
Switch bool `mapstructure:"switch" json:"switch" yaml:"switch"`
StartTime string `mapstructure:"start-time" json:"start-time" yaml:"start-time"`
EndTime string `mapstructure:"end-time" json:"end-time" yaml:"end-time"`
}
type Verify struct {
Three bool `mapstructure:"three" json:"three" yaml:"three"`
}
type Setting struct {
Sign bool `mapstructure:"sign" json:"sign" yaml:"sign"`
}