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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package config
  2. import (
  3. "gitlink.org.cn/cloudream/common/pkgs/logger"
  4. "gitlink.org.cn/cloudream/common/utils/config"
  5. "gitlink.org.cn/cloudream/jcs-pub/client/internal/accesstoken"
  6. "gitlink.org.cn/cloudream/jcs-pub/client/internal/cluster"
  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/publock"
  13. "gitlink.org.cn/cloudream/jcs-pub/client/internal/ticktock"
  14. stgglb "gitlink.org.cn/cloudream/jcs-pub/common/globals"
  15. "gitlink.org.cn/cloudream/jcs-pub/common/pkgs/connectivity"
  16. "gitlink.org.cn/cloudream/jcs-pub/common/pkgs/rpc"
  17. corrpc "gitlink.org.cn/cloudream/jcs-pub/common/pkgs/rpc/coordinator"
  18. hubrpc "gitlink.org.cn/cloudream/jcs-pub/common/pkgs/rpc/hub"
  19. "gitlink.org.cn/cloudream/jcs-pub/common/pkgs/sysevent"
  20. )
  21. type Config struct {
  22. Local stgglb.LocalMachineInfo `json:"local"`
  23. HubRPC hubrpc.PoolConfigJSON `json:"hubRPC"`
  24. CoordinatorRPC corrpc.PoolConfigJSON `json:"coordinatorRPC"`
  25. Logger logger.Config `json:"logger"`
  26. DB db.Config `json:"db"`
  27. SysEvent sysevent.Config `json:"sysEvent"`
  28. Connectivity connectivity.Config `json:"connectivity"`
  29. Downloader downloader.Config `json:"downloader"`
  30. DownloadStrategy strategy.Config `json:"downloadStrategy"`
  31. TickTock ticktock.Config `json:"tickTock"`
  32. HTTP *http.ConfigJSON `json:"http"`
  33. RPC rpc.Config `json:"rpc"`
  34. Mount *mntcfg.Config `json:"mount"`
  35. AccessToken *accesstoken.Config `json:"accessToken"`
  36. Cluster cluster.Config `json:"cluster"`
  37. PubLock publock.Config `json:"publock"`
  38. }
  39. var cfg Config
  40. // Init 初始化client
  41. // TODO 这里的modeulName参数弄成可配置的更好
  42. func Init(configPath string) error {
  43. if configPath == "" {
  44. return config.Load("config.json", &cfg)
  45. }
  46. return config.Load(configPath, &cfg)
  47. }
  48. func Cfg() *Config {
  49. return &cfg
  50. }

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