初始化
This commit is contained in:
@@ -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"`
|
||||
}
|
||||
@@ -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"` // 加密方式
|
||||
}
|
||||
@@ -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"` // 日志名称
|
||||
}
|
||||
@@ -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全局日志
|
||||
}
|
||||
@@ -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"`
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
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"` // 连接池大小
|
||||
Db int `mapstructure:"db" json:"db" yaml:"db"` // 数据库
|
||||
}
|
||||
Reference in New Issue
Block a user