You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

config.go 1.9 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package config
  2. import (
  3. "gitlink.org.cn/cloudream/common/pkgs/distlock"
  4. "gitlink.org.cn/cloudream/common/pkgs/logger"
  5. "gitlink.org.cn/cloudream/common/pkgs/mq"
  6. "gitlink.org.cn/cloudream/common/utils/config"
  7. "gitlink.org.cn/cloudream/storage2/client/internal/db"
  8. "gitlink.org.cn/cloudream/storage2/client/internal/downloader"
  9. "gitlink.org.cn/cloudream/storage2/client/internal/downloader/strategy"
  10. clitypes "gitlink.org.cn/cloudream/storage2/client/types"
  11. stgglb "gitlink.org.cn/cloudream/storage2/common/globals"
  12. "gitlink.org.cn/cloudream/storage2/common/pkgs/connectivity"
  13. agtrpc "gitlink.org.cn/cloudream/storage2/common/pkgs/grpc/agent"
  14. )
  15. type Config struct {
  16. Local stgglb.LocalMachineInfo `json:"local"`
  17. AgentGRPC agtrpc.PoolConfig `json:"agentGRPC"`
  18. Logger logger.Config `json:"logger"`
  19. RabbitMQ mq.Config `json:"rabbitMQ"`
  20. DistLock distlock.Config `json:"distlock"`
  21. Connectivity connectivity.Config `json:"connectivity"`
  22. Downloader downloader.Config `json:"downloader"`
  23. DownloadStrategy strategy.Config `json:"downloadStrategy"`
  24. UserSpaceID clitypes.UserSpaceID `json:"userSpaceID"` // TODO 进行访问量统计时,当前客户端所属的存储ID。临时解决方案。
  25. AuthAccessKey string `json:"authAccessKey"` // TODO 临时办法
  26. AuthSecretKey string `json:"authSecretKey"`
  27. MaxHTTPBodySize int64 `json:"maxHttpBodySize"`
  28. DB db.Config `json:"db"`
  29. }
  30. var cfg Config
  31. // Init 初始化client
  32. // TODO 这里的modeulName参数弄成可配置的更好
  33. func Init(configPath string) error {
  34. if configPath == "" {
  35. return config.DefaultLoad("client", &cfg)
  36. }
  37. return config.Load(configPath, &cfg)
  38. }
  39. func Cfg() *Config {
  40. return &cfg
  41. }

本项目旨在将云际存储公共基础设施化,使个人及企业可低门槛使用高效的云际存储服务(安装开箱即用云际存储客户端即可,无需关注其他组件的部署),同时支持用户灵活便捷定制云际存储的功能细节。