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

преди 1 година
12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. SmartCanteenPay string `yaml:"smart_canteen_pay"`
  11. DB DBCfg `yaml:"db"`
  12. Log LogCfg `yaml:"log"`
  13. }
  14. //数据库配置结构体
  15. type DBCfg struct {
  16. Host string `yaml:"host"` //ip及端口
  17. Name string `yaml:"name"` //库名
  18. User string `yaml:"user"` //用户
  19. Psw string `yaml:"psw"` //密码
  20. ShowLog bool `yaml:"show_log"` //是否显示SQL语句
  21. MaxLifetime time.Duration `yaml:"max_lifetime"`
  22. MaxOpenConns int `yaml:"max_open_conns"`
  23. MaxIdleConns int `yaml:"max_idle_conns"`
  24. Path string `yaml:"path"` //日志文件存放路径
  25. }
  26. //日志配置结构体
  27. type LogCfg struct {
  28. AppName string `yaml:"app_name" `
  29. Level string `yaml:"level"`
  30. IsStdOut bool `yaml:"is_stdout"`
  31. TimeFormat string `yaml:"time_format"` // second, milli, nano, standard, iso,
  32. Encoding string `yaml:"encoding"` // console, json
  33. IsFileOut bool `yaml:"is_file_out"`
  34. FileDir string `yaml:"file_dir"`
  35. FileName string `yaml:"file_name"`
  36. FileMaxSize int `yaml:"file_max_size"`
  37. FileMaxAge int `yaml:"file_max_age"`
  38. }