附近小店
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

cfg_app.go 3.5 KiB

3ヶ月前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. RedisAddrSecond RedisAddrSeconds `yaml:"redis_addr_second"`
  12. DB DBCfg `yaml:"db"`
  13. MQ MQCfg `yaml:"mq"`
  14. ES ESCfg `yaml:"es"`
  15. Log LogCfg `yaml:"log"`
  16. ArkID ArkIDCfg `yaml:"arkid"`
  17. Admin AdminCfg `yaml:"admin"`
  18. Official OfficialCfg `yaml:"official"`
  19. WebsiteBackend WebsiteBackendCfg `yaml:"website_backend"`
  20. WxappletFilepath WxappletFilepathCfg `yaml:"wxapplet_filepath"`
  21. H5Filepath H5FilepathCfg `yaml:"h5_filepath"`
  22. ImBusinessRpc ImBusinessRpcCfg `yaml:"im_business_rpc"`
  23. Local bool
  24. AppComm AppCommCfg `yaml:"app_comm"`
  25. Zhimeng ZhimengCfg `yaml:"zm"`
  26. Supply SupplyCfg `yaml:"supply"`
  27. ZhiosOpen ZhiosOpenCfg `yaml:"zhios_open"`
  28. ZhimengDB DBCfg `yaml:"zhimeng_db"`
  29. }
  30. type RedisAddrSeconds struct {
  31. Addr string `json:"addr"`
  32. Pwd string `json:"pwd"`
  33. }
  34. type ZhiosOpenCfg struct {
  35. URL string `yaml:"url"`
  36. }
  37. type ImBusinessRpcCfg struct {
  38. URL string `yaml:"url"`
  39. PORT string `yaml:"port"`
  40. }
  41. // 公共模块
  42. type AppCommCfg struct {
  43. URL string `yaml:"url"`
  44. }
  45. type SupplyCfg struct {
  46. URL string `yaml:"url"`
  47. }
  48. type ZhimengCfg struct {
  49. URL string `yaml:"url"`
  50. }
  51. // OfficialCfg is 官网
  52. type OfficialCfg struct {
  53. URL string `yaml:"url"`
  54. }
  55. type WxappletFilepathCfg struct {
  56. URL string `yaml:"url"`
  57. }
  58. type H5FilepathCfg struct {
  59. URL string `yaml:"url"`
  60. }
  61. type WebsiteBackendCfg struct {
  62. URL string `yaml:"url"`
  63. }
  64. // AdminCfg is 后台接口调用需要
  65. type AdminCfg struct {
  66. URL string `yaml:"url"`
  67. IURL string `yaml:"iurl"`
  68. AesKey string `yaml:"api_aes_key"`
  69. AesIV string `yaml:"api_aes_iv"`
  70. }
  71. type ArkIDCfg struct {
  72. Admin string `yaml:"admin"`
  73. AdminPassword string `yaml:"admin_password"`
  74. Url string `yaml:"url`
  75. }
  76. //数据库配置结构体
  77. type DBCfg struct {
  78. Host string `yaml:"host"` //ip及端口
  79. Name string `yaml:"name"` //库名
  80. User string `yaml:"user"` //用户
  81. Psw string `yaml:"psw"` //密码
  82. ShowLog bool `yaml:"show_log"` //是否显示SQL语句
  83. MaxLifetime time.Duration `yaml:"max_lifetime"`
  84. MaxOpenConns int `yaml:"max_open_conns"`
  85. MaxIdleConns int `yaml:"max_idle_conns"`
  86. Path string `yaml:"path"` //日志文件存放路径
  87. }
  88. type MQCfg struct {
  89. Host string `yaml:"host"`
  90. Port string `yaml:"port"`
  91. User string `yaml:"user"`
  92. Pwd string `yaml:"pwd"`
  93. }
  94. type ESCfg struct {
  95. Url string `yaml:"url"`
  96. User string `yaml:"user"`
  97. Pwd string `yaml:"pwd"`
  98. }
  99. //日志配置结构体
  100. type LogCfg struct {
  101. AppName string `yaml:"app_name" `
  102. Level string `yaml:"level"`
  103. IsStdOut bool `yaml:"is_stdout"`
  104. TimeFormat string `yaml:"time_format"` // second, milli, nano, standard, iso,
  105. Encoding string `yaml:"encoding"` // console, json
  106. IsFileOut bool `yaml:"is_file_out"`
  107. FileDir string `yaml:"file_dir"`
  108. FileName string `yaml:"file_name"`
  109. FileMaxSize int `yaml:"file_max_size"`
  110. FileMaxAge int `yaml:"file_max_age"`
  111. }