广告平台(站长使用)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cfg_app.go 1.5 KiB

3 maanden geleden
3 maanden geleden
2 maanden geleden
3 maanden geleden
3 maanden geleden
2 maanden geleden
3 maanden geleden
3 maanden geleden
3 maanden geleden
3 maanden geleden
3 maanden geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package cfg
  2. import (
  3. "time"
  4. )
  5. type Config struct {
  6. Debug bool `yaml:"debug"`
  7. Prd bool `yaml:"prd"`
  8. CurlDebug bool `yaml:"curldebug"`
  9. SrvAddr string `yaml:"srv_addr"`
  10. RedisAddr string `yaml:"redis_addr"`
  11. MQ MQCfg `yaml:"mq"`
  12. DB DBCfg `yaml:"db"`
  13. Log LogCfg `yaml:"log"`
  14. Local bool
  15. }
  16. type MQCfg struct {
  17. Host string `yaml:"host"`
  18. Port string `yaml:"port"`
  19. User string `yaml:"user"`
  20. Pwd string `yaml:"pwd"`
  21. }
  22. // 数据库配置结构体
  23. type DBCfg struct {
  24. Host string `yaml:"host"` //ip及端口
  25. Name string `yaml:"name"` //库名
  26. User string `yaml:"user"` //用户
  27. Psw string `yaml:"psw"` //密码
  28. ShowLog bool `yaml:"show_log"` //是否显示SQL语句
  29. MaxLifetime time.Duration `yaml:"max_lifetime"`
  30. MaxOpenConns int `yaml:"max_open_conns"`
  31. MaxIdleConns int `yaml:"max_idle_conns"`
  32. Path string `yaml:"path"` //日志文件存放路径
  33. }
  34. // 日志配置结构体
  35. type LogCfg struct {
  36. AppName string `yaml:"app_name" `
  37. Level string `yaml:"level"`
  38. IsStdOut bool `yaml:"is_stdout"`
  39. TimeFormat string `yaml:"time_format"` // second, milli, nano, standard, iso,
  40. Encoding string `yaml:"encoding"` // console, json
  41. IsFileOut bool `yaml:"is_file_out"`
  42. FileDir string `yaml:"file_dir"`
  43. FileName string `yaml:"file_name"`
  44. FileMaxSize int `yaml:"file_max_size"`
  45. FileMaxAge int `yaml:"file_max_age"`
  46. }