config.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package config
  2. import (
  3. "github.com/zeromicro/go-zero/core/stores/cache"
  4. "github.com/zeromicro/go-zero/rest"
  5. "github.com/zeromicro/go-zero/zrpc"
  6. )
  7. type CacheRedisConf struct {
  8. Nodes cache.CacheConf
  9. KeyPrefix string `json:",optional"`
  10. }
  11. type CapjsConf struct {
  12. Enable int64 `json:",optional"` // 1 启用,0 或未配置则禁用
  13. EndpointURL string `json:",optional"` // cap.js 服务地址,如 https://cap.example.com
  14. Key string `json:",optional"` // cap.js site key
  15. Secret string `json:",optional"` // cap.js site secret(用于服务端 siteverify)
  16. }
  17. type MinioFileTypeConf struct {
  18. Bucket string
  19. Dir string
  20. AllowedContentTypes []string `json:",optional"`
  21. }
  22. type MinioConf struct {
  23. Name string
  24. AccessKeyId string
  25. AccessKeySecret string
  26. Endpoint string
  27. Domain string
  28. UseSSL bool `json:",default=false"`
  29. FileType map[string]MinioFileTypeConf `json:",optional"`
  30. }
  31. type Config struct {
  32. rest.RestConf
  33. RpcServerConf zrpc.RpcServerConf
  34. MySQL struct {
  35. DataSource string
  36. }
  37. CacheRedis CacheRedisConf
  38. Auth struct {
  39. AccessSecret string
  40. AccessExpire int64
  41. RefreshSecret string
  42. RefreshExpire int64
  43. ManagementKey string
  44. }
  45. Capjs CapjsConf `json:",optional"`
  46. Minio MinioConf `json:",optional"`
  47. BehindProxy bool `json:",optional"`
  48. }