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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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/jcs-pub/client/internal/db"
  8. "gitlink.org.cn/cloudream/jcs-pub/client/internal/downloader"
  9. "gitlink.org.cn/cloudream/jcs-pub/client/internal/downloader/strategy"
  10. "gitlink.org.cn/cloudream/jcs-pub/client/internal/http"
  11. mntcfg "gitlink.org.cn/cloudream/jcs-pub/client/internal/mount/config"
  12. "gitlink.org.cn/cloudream/jcs-pub/client/internal/ticktock"
  13. stgglb "gitlink.org.cn/cloudream/jcs-pub/common/globals"
  14. "gitlink.org.cn/cloudream/jcs-pub/common/pkgs/connectivity"
  15. hubrpc "gitlink.org.cn/cloudream/jcs-pub/common/pkgs/grpc/hub"
  16. )
  17. type Config struct {
  18. Local stgglb.LocalMachineInfo `json:"local"`
  19. HubGRPC hubrpc.PoolConfig `json:"hubGRPC"`
  20. Logger logger.Config `json:"logger"`
  21. DB db.Config `json:"db"`
  22. RabbitMQ mq.Config `json:"rabbitMQ"`
  23. DistLock distlock.Config `json:"distlock"`
  24. Connectivity connectivity.Config `json:"connectivity"`
  25. Downloader downloader.Config `json:"downloader"`
  26. DownloadStrategy strategy.Config `json:"downloadStrategy"`
  27. TickTock ticktock.Config `json:"tickTock"`
  28. HTTP *http.Config `json:"http"`
  29. Mount *mntcfg.Config `json:"mount"`
  30. }
  31. var cfg Config
  32. // Init 初始化client
  33. // TODO 这里的modeulName参数弄成可配置的更好
  34. func Init(configPath string) error {
  35. if configPath == "" {
  36. return config.DefaultLoad("client", &cfg)
  37. }
  38. return config.Load(configPath, &cfg)
  39. }
  40. func Cfg() *Config {
  41. return &cfg
  42. }

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