This commit is contained in:
2024-06-19 14:30:11 +08:00
parent 9a9f3b71ff
commit 737c0eb28f
64 changed files with 3925 additions and 1 deletions
+14
View File
@@ -0,0 +1,14 @@
package config
var C Config
type Config struct {
Port int `mapstructure:"port" json:"port" yaml:"port"`
Env string `mapstructure:"env" json:"Env" yaml:"Env"`
Mysql Mysql `mapstructure:"mysql" json:"mysql" yaml:"mysql"`
Log Log `mapstructure:"log" json:"log" yaml:"log"`
Redis Redis `mapstructure:"redis" json:"redis" yaml:"redis"`
Jwt Jwt `mapstructure:"jwt" json:"jwt" yaml:"jwt"`
Oss Oss `mapstructure:"oss" json:"oss" yaml:"oss"`
Snowflake int64 `mapstructure:"snowflake" json:"snowflake" yaml:"snowflake"`
}
+7
View File
@@ -0,0 +1,7 @@
package config
type Jwt struct {
SignKey string `mapstructure:"sign-key" json:"sign-key" yaml:"sign-key"` // 私钥
Ttl int `mapstructure:"ttl" json:"ttl" yaml:"ttl"` // 过期时间 小时
Algo string `mapstructure:"algo" json:"algo" yaml:"algo"` // 加密方式
}
+6
View File
@@ -0,0 +1,6 @@
package config
type Log struct {
FilePath string `mapstructure:"file-path" json:"file-path" yaml:"file-path"` // 日志目录
FileName string `mapstructure:"file-name" json:"file-name" yaml:"file-name"` // 日志名称
}
+12
View File
@@ -0,0 +1,12 @@
package config
type Mysql struct {
Host string `mapstructure:"host" json:"host" yaml:"host"` // 服务器地址
Port int `mapstructure:"port" json:"port" yaml:"port"` // 端口
DbName string `mapstructure:"db-name" json:"db-name" yaml:"db-name"` // 数据库名
Username string `mapstructure:"username" json:"username" yaml:"username"` // 数据库用户名
Password string `mapstructure:"password" json:"password" yaml:"password"` // 数据库密码
MaxIdleConns int `mapstructure:"max-idle-cons" json:"MaxIdleConns" yaml:"max-idle-cons"` // 空闲中的最大连接数
MaxOpenConns int `mapstructure:"max-open-cons" json:"MaxOpenConns" yaml:"max-open-cons"` // 打开到数据库的最大连接数
Debug bool `mapstructure:"debug" json:"debug" yaml:"debug"` // 是否开启Gorm全局日志
}
+9
View File
@@ -0,0 +1,9 @@
package config
type Oss struct {
OssAccessKey string `mapstructure:"oss-access-key" json:"oss-access-key" yaml:"oss-access-key"`
OssAccessKeySecret string `mapstructure:"oss-access-key-secret" json:"oss-access-key-secret" yaml:"oss-access-key-secret"`
OssBucket string `mapstructure:"oss-bucket" json:"oss-bucket" yaml:"oss-bucket"`
OssEndpoint string `mapstructure:"oss-endpoint" json:"oss-endpoint" yaml:"oss-endpoint"`
OssCustomDomainName string `mapstructure:"oss-custom-domain-name" json:"oss-custom-domain-name" yaml:"oss-custom-domain-name"`
}
+8
View File
@@ -0,0 +1,8 @@
package config
type Redis struct {
Host string `mapstructure:"host" json:"host" yaml:"host"` // 服务器地址
Port int `mapstructure:"port" json:"port" yaml:"port"` // 服务器端口
Password string `mapstructure:"password" json:"password" yaml:"password"` // 密码
PoolSize int `mapstructure:"pool-size" json:"pool-size" yaml:"pool-size"` // 连接池大小
}