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"` MqWorkQueueName string `yaml:"mq_work_queue_name"` RabbitMqAddr string `yaml:"rabbitMq_addr"` RabbitMqAddrTest string `yaml:"rabbitMq_addr_test"` DB DBCfg `yaml:"db"` DataDB DBCfg `yaml:"data_db"` MQ MQCfg `yaml:"mq"` ES ESCfg `yaml:"es"` Log LogCfg `yaml:"log"` ArkID ArkIDCfg `yaml:"arkid"` Admin AdminCfg `yaml:"admin"` Official OfficialCfg `yaml:"official"` WxappletFilepath WxappletFilepathCfg `yaml:"wxapplet_filepath"` Local bool AppComm AppCommCfg `yaml:"app_comm"` } // 公共模块 type AppCommCfg struct { URL string `yaml:"url"` } // OfficialCfg is 官网 type OfficialCfg struct { URL string `yaml:"url"` } type WxappletFilepathCfg struct { URL string `yaml:"url"` } // AdminCfg is 后台接口调用需要 type AdminCfg struct { URL string `yaml:"url"` IURL string `yaml:"iurl"` AesKey string `yaml:"api_aes_key"` AesIV string `yaml:"api_aes_iv"` Host string `yaml:"host"` } type ArkIDCfg struct { Admin string `yaml:"admin"` AdminPassword string `yaml:"admin_password"` Url string `yaml:"url` } //数据库配置结构体 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 MQCfg struct { Host string `yaml:"host"` Port string `yaml:"port"` User string `yaml:"user"` Pwd string `yaml:"pwd"` } type ESCfg struct { Url string `yaml:"url"` User string `yaml:"user"` Pwd string `yaml:"pwd"` } //日志配置结构体 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"` }