Migrating configuration files from json to yaml

This commit is contained in:
Granty1
2020-04-05 20:35:52 +08:00
parent 81a54b5a44
commit 7c52c05280
4 changed files with 96 additions and 91 deletions

View File

@@ -1,64 +1,60 @@
package config
type Server struct {
Mysql Mysql `json:"mysql"`
Qiniu Qiniu `json:"qiniu"`
Casbin Casbin `json:"casbin"`
Redis Redis `json:"redis"`
System System `json:"system"`
JWT JWT `json:"jwt"`
Captcha Captcha `json:"captcha"`
Log Log `json:"log"`
Mysql `mapstructure:"mysql"`
Qiniu `mapstructure:"qiniu"`
Casbin `mapstructure:"casbin"`
Redis `mapstructure:"redis"`
System `mapstructure:"system"`
JWT `mapstructure:"jwt"`
Captcha `mapstructure:"captcha"`
Log `mapstructure:"log"`
}
type System struct { // 系统配置
UseMultipoint bool `json:"useMultipoint"`
Env string `json:"env"`
Addr int `json:"addr"`
type System struct {
UseMultipoint bool `mapstructure:"use-multipoint"`
Env string `mapstructure:"env"`
Addr int `mapstructure:"addr"`
}
type JWT struct { // jwt签名
SigningKey string `json:"signingKey"`
type JWT struct {
SigningKey string `mapstructure:"signing-key"`
}
type Casbin struct { //casbin配置
ModelPath string `json:"modelPath"` // casbin model地址配置
type Casbin struct {
ModelPath string `mapstructure:"model-path"`
}
type Mysql struct { // mysql admin 数据库配置
Username string `json:"username"`
Password string `json:"password"`
Path string `json:"path"`
Dbname string `json:"dbname"`
Config string `json:"config"`
MaxIdleConns int `json:"maxIdleConns"`
MaxOpenConns int `json:"maxOpenConns"`
LogMode bool `json:"maxOpenConns"`
type Mysql struct {
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
Path string `mapstructure:"path"`
Dbname string `mapstructure:"db-name"`
Config string `mapstructure:"config"`
MaxIdleConns int `mapstructure:"max-idle-conns"`
MaxOpenConns int `mapstructure:"max-open-conns"`
LogMode bool `mapstructure:"log-mode"`
}
type Redis struct { // Redis admin 数据库配置
Addr string `json:"addr"`
Password string `json:"password"`
DB int `json:"db"`
type Redis struct {
Addr string `mapstructure:"addr"`
Password string `mapstructure:"password"`
DB int `mapstructure:"db"`
}
type Qiniu struct { // 七牛 密钥配置
AccessKey string `json:"accessKey"`
SecretKey string `json:"secretKey"`
type Qiniu struct {
AccessKey string `mapstructure:"access-key"`
SecretKey string `mapstructure:"secret-key"`
}
type Captcha struct { // 验证码配置
KeyLong int `json:"keyLong"`
ImgWidth int `json:"imgWidth"`
ImgHeight int `json:"imgHeight"`
type Captcha struct {
KeyLong int `mapstructure:"key-long"`
ImgWidth int `mapstructure:"img-width"`
ImgHeight int `mapstructure:"img-height"`
}
type Log struct {
// log 打印的前缀
Prefix string `json:"prefix"`
// 是否显示打印log的文件具体路径
LogFile bool `json:"logFile"`
// 在控制台打印log的级别 "" 默认不打印
Stdout string `json:"stdout"`
// 在文件中打印log的级别 "" 默认不打印
File string `json:"file"`
Prefix string `mapstructure:"prefix"`
LogFile bool `mapstructure:"log-file"`
Stdout string `mapstructure:"stdout"`
File string `mapstructure:"file"`
}