蛋蛋星球 后台端
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.2 KiB

2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. }
  19. type ImBusinessRpcCfg struct {
  20. URL string `yaml:"url"`
  21. PORT string `yaml:"port"`
  22. }
  23. type ImLogicRpcCfg struct {
  24. URL string `yaml:"url"`
  25. PORT string `yaml:"port"`
  26. }
  27. type AppCommCfg struct {
  28. OuterURL string `yaml:"outer_url"` // 本模块外部地址
  29. }
  30. type ArkIDCfg struct {
  31. Admin string `yaml:"admin"`
  32. AdminPassword string `yaml:"admin_password"`
  33. Url string `yaml:"url"`
  34. }
  35. // 数据库配置结构体
  36. type DBCfg struct {
  37. Host string `yaml:"host"` //ip及端口
  38. Name string `yaml:"name"` //库名
  39. User string `yaml:"user"` //用户
  40. Psw string `yaml:"psw"` //密码
  41. ShowLog bool `yaml:"show_log"` //是否显示SQL语句
  42. MaxLifetime time.Duration `yaml:"max_lifetime"`
  43. MaxOpenConns int `yaml:"max_open_conns"`
  44. MaxIdleConns int `yaml:"max_idle_conns"`
  45. Path string `yaml:"path"` //日志文件存放路径
  46. }
  47. // 日志配置结构体
  48. type LogCfg struct {
  49. AppName string `yaml:"app_name" `
  50. Level string `yaml:"level"`
  51. IsStdOut bool `yaml:"is_stdout"`
  52. TimeFormat string `yaml:"time_format"` // second, milli, nano, standard, iso,
  53. Encoding string `yaml:"encoding"` // console, json
  54. IsFileOut bool `yaml:"is_file_out"`
  55. FileDir string `yaml:"file_dir"`
  56. FileName string `yaml:"file_name"`
  57. FileMaxSize int `yaml:"file_max_size"`
  58. FileMaxAge int `yaml:"file_max_age"`
  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. }