智慧食堂
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.

53 rivejä
1.6 KiB

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