蛋蛋星球-客户端
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

5 days ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. RedisPassword string `yaml:"redis_password"`
  12. DB DBCfg `yaml:"db"`
  13. Log LogCfg `yaml:"log"`
  14. ImBusinessRpc ImBusinessRpcCfg `yaml:"im_business_rpc"`
  15. ImLogicRpc ImLogicRpcCfg `yaml:"im_logic_rpc"`
  16. Local bool
  17. MQ MQCfg `yaml:"mq"`
  18. ES ESCfg
  19. }
  20. type ImBusinessRpcCfg struct {
  21. URL string `yaml:"url"`
  22. PORT string `yaml:"port"`
  23. }
  24. type ImLogicRpcCfg struct {
  25. URL string `yaml:"url"`
  26. PORT string `yaml:"port"`
  27. }
  28. type AppCommCfg struct {
  29. OuterURL string `yaml:"outer_url"` // 本模块外部地址
  30. }
  31. type ArkIDCfg struct {
  32. Admin string `yaml:"admin"`
  33. AdminPassword string `yaml:"admin_password"`
  34. Url string `yaml:"url"`
  35. }
  36. // 数据库配置结构体
  37. type DBCfg struct {
  38. Host string `yaml:"host"` //ip及端口
  39. Name string `yaml:"name"` //库名
  40. User string `yaml:"user"` //用户
  41. Psw string `yaml:"psw"` //密码
  42. ShowLog bool `yaml:"show_log"` //是否显示SQL语句
  43. MaxLifetime time.Duration `yaml:"max_lifetime"`
  44. MaxOpenConns int `yaml:"max_open_conns"`
  45. MaxIdleConns int `yaml:"max_idle_conns"`
  46. Path string `yaml:"path"` //日志文件存放路径
  47. }
  48. // 日志配置结构体
  49. type LogCfg struct {
  50. AppName string `yaml:"app_name" `
  51. Level string `yaml:"level"`
  52. IsStdOut bool `yaml:"is_stdout"`
  53. TimeFormat string `yaml:"time_format"` // second, milli, nano, standard, iso,
  54. Encoding string `yaml:"encoding"` // console, json
  55. IsFileOut bool `yaml:"is_file_out"`
  56. FileDir string `yaml:"file_dir"`
  57. FileName string `yaml:"file_name"`
  58. FileMaxSize int `yaml:"file_max_size"`
  59. FileMaxAge int `yaml:"file_max_age"`
  60. }
  61. type MQCfg struct {
  62. Host string `yaml:"host"`
  63. Port string `yaml:"port"`
  64. User string `yaml:"user"`
  65. Pwd string `yaml:"pwd"`
  66. }
  67. type ESCfg struct {
  68. Url string `yaml:"url"`
  69. User string `yaml:"user"`
  70. Pwd string `yaml:"pwd"`
  71. }