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.7 kB

10 months ago
1234567891011121314151617181920212223242526272829303132333435363738394041
  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. cdssdk "gitlink.org.cn/cloudream/common/sdks/storage"
  7. "gitlink.org.cn/cloudream/common/utils/config"
  8. stgmodels "gitlink.org.cn/cloudream/storage2/common/models"
  9. "gitlink.org.cn/cloudream/storage2/common/pkgs/connectivity"
  10. "gitlink.org.cn/cloudream/storage2/common/pkgs/downloader"
  11. "gitlink.org.cn/cloudream/storage2/common/pkgs/downloader/strategy"
  12. agtrpc "gitlink.org.cn/cloudream/storage2/common/pkgs/grpc/agent"
  13. )
  14. type Config struct {
  15. Local stgmodels.LocalMachineInfo `json:"local"`
  16. AgentGRPC agtrpc.PoolConfig `json:"agentGRPC"`
  17. Logger logger.Config `json:"logger"`
  18. RabbitMQ mq.Config `json:"rabbitMQ"`
  19. DistLock distlock.Config `json:"distlock"`
  20. Connectivity connectivity.Config `json:"connectivity"`
  21. Downloader downloader.Config `json:"downloader"`
  22. DownloadStrategy strategy.Config `json:"downloadStrategy"`
  23. StorageID cdssdk.StorageID `json:"storageID"` // TODO 进行访问量统计时,当前客户端所属的存储ID。临时解决方案。
  24. AuthAccessKey string `json:"authAccessKey"` // TODO 临时办法
  25. AuthSecretKey string `json:"authSecretKey"`
  26. MaxHTTPBodySize int64 `json:"maxHttpBodySize"`
  27. }
  28. var cfg Config
  29. // Init 初始化client
  30. // TODO 这里的modeulName参数弄成可配置的更好
  31. func Init() error {
  32. return config.DefaultLoad("client", &cfg)
  33. }
  34. func Cfg() *Config {
  35. return &cfg
  36. }

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