35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
package config
|
|
|
|
import (
|
|
"gitlink.org.cn/cloudream/common/pkgs/distlock"
|
|
"gitlink.org.cn/cloudream/common/pkgs/ipfs"
|
|
"gitlink.org.cn/cloudream/common/pkgs/logger"
|
|
"gitlink.org.cn/cloudream/common/utils/config"
|
|
stgmodels "gitlink.org.cn/cloudream/storage/common/models"
|
|
"gitlink.org.cn/cloudream/storage/common/pkgs/connectivity"
|
|
agtrpc "gitlink.org.cn/cloudream/storage/common/pkgs/grpc/agent"
|
|
stgmq "gitlink.org.cn/cloudream/storage/common/pkgs/mq"
|
|
)
|
|
|
|
type Config struct {
|
|
Local stgmodels.LocalMachineInfo `json:"local"`
|
|
AgentGRPC agtrpc.PoolConfig `json:"agentGRPC"`
|
|
Logger logger.Config `json:"logger"`
|
|
RabbitMQ stgmq.Config `json:"rabbitMQ"`
|
|
IPFS *ipfs.Config `json:"ipfs"` // 此字段非空代表客户端上存在ipfs daemon
|
|
DistLock distlock.Config `json:"distlock"`
|
|
Connectivity connectivity.Config `json:"connectivity"`
|
|
}
|
|
|
|
var cfg Config
|
|
|
|
// Init 初始化client
|
|
// TODO 这里的modeulName参数弄成可配置的更好
|
|
func Init() error {
|
|
return config.DefaultLoad("client", &cfg)
|
|
}
|
|
|
|
func Cfg() *Config {
|
|
return &cfg
|
|
}
|