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.

cfg_app.go 2.9 KiB

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