package config import ( "gitlink.org.cn/cloudream/common/pkgs/distlock" "gitlink.org.cn/cloudream/common/pkgs/logger" "gitlink.org.cn/cloudream/common/pkgs/mq" "gitlink.org.cn/cloudream/common/utils/config" "gitlink.org.cn/cloudream/storage2/client/internal/downloader" "gitlink.org.cn/cloudream/storage2/client/internal/downloader/strategy" "gitlink.org.cn/cloudream/storage2/client/types" "gitlink.org.cn/cloudream/storage2/common/pkgs/connectivity" db "gitlink.org.cn/cloudream/storage2/common/pkgs/db2/config" agtrpc "gitlink.org.cn/cloudream/storage2/common/pkgs/grpc/agent" cortypes "gitlink.org.cn/cloudream/storage2/coordinator/types" ) type Config struct { Local types.LocalMachineInfo `json:"local"` AgentGRPC agtrpc.PoolConfig `json:"agentGRPC"` Logger logger.Config `json:"logger"` RabbitMQ mq.Config `json:"rabbitMQ"` DistLock distlock.Config `json:"distlock"` Connectivity connectivity.Config `json:"connectivity"` Downloader downloader.Config `json:"downloader"` DownloadStrategy strategy.Config `json:"downloadStrategy"` StorageID cortypes.StorageID `json:"storageID"` // TODO 进行访问量统计时,当前客户端所属的存储ID。临时解决方案。 AuthAccessKey string `json:"authAccessKey"` // TODO 临时办法 AuthSecretKey string `json:"authSecretKey"` MaxHTTPBodySize int64 `json:"maxHttpBodySize"` DB db.Config `json:"db"` } var cfg Config // Init 初始化client // TODO 这里的modeulName参数弄成可配置的更好 func Init(configPath string) error { if configPath == "" { return config.DefaultLoad("client", &cfg) } return config.Load(configPath, &cfg) } func Cfg() *Config { return &cfg }