|
1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- package cfg
-
- import (
- "time"
- )
-
- type Config struct {
- Debug bool `yaml:"debug"`
- Prd bool `yaml:"prd"`
- CurlDebug bool `yaml:"curldebug"`
- SrvAddr string `yaml:"srv_addr"`
- RedisAddr string `yaml:"redis_addr"`
- DB DBCfg `yaml:"db"`
- Log LogCfg `yaml:"log"`
- Local bool
- }
-
- // 数据库配置结构体
- type DBCfg struct {
- Host string `yaml:"host"` //ip及端口
- Name string `yaml:"name"` //库名
- User string `yaml:"user"` //用户
- Psw string `yaml:"psw"` //密码
- ShowLog bool `yaml:"show_log"` //是否显示SQL语句
- MaxLifetime time.Duration `yaml:"max_lifetime"`
- MaxOpenConns int `yaml:"max_open_conns"`
- MaxIdleConns int `yaml:"max_idle_conns"`
- Path string `yaml:"path"` //日志文件存放路径
- }
-
- // 日志配置结构体
- type LogCfg struct {
- AppName string `yaml:"app_name" `
- Level string `yaml:"level"`
- IsStdOut bool `yaml:"is_stdout"`
- TimeFormat string `yaml:"time_format"` // second, milli, nano, standard, iso,
- Encoding string `yaml:"encoding"` // console, json
-
- IsFileOut bool `yaml:"is_file_out"`
- FileDir string `yaml:"file_dir"`
- FileName string `yaml:"file_name"`
- FileMaxSize int `yaml:"file_max_size"`
- FileMaxAge int `yaml:"file_max_age"`
- }
|