golang 的 rabbitmq 消费项目
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.
 
 
 

90 lines
2.7 KiB

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