面包店
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 2.3 KiB

10 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. DB DBCfg `yaml:"db"`
  12. Log LogCfg `yaml:"log"`
  13. ArkID ArkIDCfg `yaml:"arkid"`
  14. Admin AdminCfg `yaml:"admin"`
  15. Official OfficialCfg `yaml:"official"`
  16. WxappletFilepath WxappletFilepathCfg `yaml:"wxapplet_filepath"`
  17. Local bool
  18. AppComm AppCommCfg `yaml:"app_comm"`
  19. }
  20. // 公共模块
  21. type AppCommCfg struct {
  22. URL string `yaml:"url"`
  23. }
  24. // OfficialCfg is 官网
  25. type OfficialCfg struct {
  26. URL string `yaml:"url"`
  27. }
  28. type WxappletFilepathCfg struct {
  29. URL string `yaml:"url"`
  30. }
  31. // AdminCfg is 后台接口调用需要
  32. type AdminCfg struct {
  33. URL string `yaml:"url"`
  34. IURL string `yaml:"iurl"`
  35. AesKey string `yaml:"api_aes_key"`
  36. AesIV string `yaml:"api_aes_iv"`
  37. Host string `yaml:"host"`
  38. }
  39. type ArkIDCfg struct {
  40. Admin string `yaml:"admin"`
  41. AdminPassword string `yaml:"admin_password"`
  42. Url string `yaml:"url`
  43. }
  44. //数据库配置结构体
  45. type DBCfg struct {
  46. Host string `yaml:"host"` //ip及端口
  47. Name string `yaml:"name"` //库名
  48. User string `yaml:"user"` //用户
  49. Psw string `yaml:"psw"` //密码
  50. ShowLog bool `yaml:"show_log"` //是否显示SQL语句
  51. MaxLifetime time.Duration `yaml:"max_lifetime"`
  52. MaxOpenConns int `yaml:"max_open_conns"`
  53. MaxIdleConns int `yaml:"max_idle_conns"`
  54. Path string `yaml:"path"` //日志文件存放路径
  55. }
  56. //日志配置结构体
  57. type LogCfg struct {
  58. AppName string `yaml:"app_name" `
  59. Level string `yaml:"level"`
  60. IsStdOut bool `yaml:"is_stdout"`
  61. TimeFormat string `yaml:"time_format"` // second, milli, nano, standard, iso,
  62. Encoding string `yaml:"encoding"` // console, json
  63. IsFileOut bool `yaml:"is_file_out"`
  64. FileDir string `yaml:"file_dir"`
  65. FileName string `yaml:"file_name"`
  66. FileMaxSize int `yaml:"file_max_size"`
  67. FileMaxAge int `yaml:"file_max_age"`
  68. }