mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-09 22:22:34 +01:00
🎨 数据同步接入 S3 协议兼容的对象存储服务 Fix https://github.com/siyuan-note/siyuan/issues/6528
This commit is contained in:
parent
9e544ed154
commit
41d9a317dc
5 changed files with 3 additions and 49 deletions
|
|
@ -242,10 +242,6 @@ func InitConf() {
|
|||
if 0 == Conf.Sync.Mode {
|
||||
Conf.Sync.Mode = 1
|
||||
}
|
||||
if nil == Conf.Sync.Qiniu {
|
||||
Conf.Sync.Qiniu = &conf.Qiniu{}
|
||||
}
|
||||
Conf.Sync.Qiniu.Endpoint = util.NormalizeEndpoint(Conf.Sync.Qiniu.Endpoint)
|
||||
if nil == Conf.Sync.S3 {
|
||||
Conf.Sync.S3 = &conf.S3{}
|
||||
}
|
||||
|
|
@ -254,10 +250,6 @@ func InitConf() {
|
|||
Conf.Sync.WebDAV = &conf.WebDAV{}
|
||||
}
|
||||
Conf.Sync.WebDAV.Endpoint = util.NormalizeEndpoint(Conf.Sync.WebDAV.Endpoint)
|
||||
if nil == Conf.Sync.OSS {
|
||||
Conf.Sync.OSS = &conf.OSS{}
|
||||
}
|
||||
Conf.Sync.OSS.Endpoint = util.NormalizeEndpoint(Conf.Sync.OSS.Endpoint)
|
||||
|
||||
if nil == Conf.Api {
|
||||
Conf.Api = conf.NewAPI()
|
||||
|
|
|
|||
|
|
@ -821,8 +821,6 @@ func newRepository() (ret *dejavu.Repo, err error) {
|
|||
switch Conf.Sync.Provider {
|
||||
case conf.ProviderSiYuan:
|
||||
cloudRepo = cloud.NewSiYuan(&cloud.BaseCloud{Conf: cloudConf})
|
||||
case conf.ProviderQiniu:
|
||||
cloudRepo = cloud.NewQiniu(&cloud.BaseCloud{Conf: cloudConf})
|
||||
case conf.ProviderS3:
|
||||
cloudRepo = cloud.NewS3(&cloud.BaseCloud{Conf: cloudConf})
|
||||
case conf.ProviderWebDAV:
|
||||
|
|
@ -833,8 +831,6 @@ func newRepository() (ret *dejavu.Repo, err error) {
|
|||
webdavClient.SetHeader("User-Agent", util.UserAgent)
|
||||
webdavClient.SetTimeout(30 * time.Second)
|
||||
cloudRepo = cloud.NewWebDAV(&cloud.BaseCloud{Conf: cloudConf}, webdavClient)
|
||||
case conf.ProviderOSS:
|
||||
cloudRepo = cloud.NewOSS(&cloud.BaseCloud{Conf: cloudConf})
|
||||
default:
|
||||
err = fmt.Errorf("unknown cloud provider [%d]", Conf.Sync.Provider)
|
||||
return
|
||||
|
|
@ -1047,11 +1043,6 @@ func buildCloudConf() (ret *cloud.Conf, err error) {
|
|||
switch Conf.Sync.Provider {
|
||||
case conf.ProviderSiYuan:
|
||||
ret.Endpoint = "https://siyuan-data.b3logfile.com/"
|
||||
case conf.ProviderQiniu:
|
||||
ret.Endpoint = Conf.Sync.Qiniu.Endpoint
|
||||
ret.AccessKey = Conf.Sync.Qiniu.AccessKey
|
||||
ret.SecretKey = Conf.Sync.Qiniu.SecretKey
|
||||
ret.Bucket = Conf.Sync.Qiniu.Bucket
|
||||
case conf.ProviderS3:
|
||||
ret.Endpoint = Conf.Sync.S3.Endpoint
|
||||
ret.AccessKey = Conf.Sync.S3.AccessKey
|
||||
|
|
@ -1062,11 +1053,6 @@ func buildCloudConf() (ret *cloud.Conf, err error) {
|
|||
ret.Endpoint = Conf.Sync.WebDAV.Endpoint
|
||||
ret.Username = Conf.Sync.WebDAV.Username
|
||||
ret.Password = Conf.Sync.WebDAV.Password
|
||||
case conf.ProviderOSS:
|
||||
ret.Endpoint = Conf.Sync.OSS.Endpoint
|
||||
ret.AccessKey = Conf.Sync.OSS.AccessKey
|
||||
ret.SecretKey = Conf.Sync.OSS.SecretKey
|
||||
ret.Bucket = Conf.Sync.OSS.Bucket
|
||||
default:
|
||||
err = fmt.Errorf("invalid provider [%d]", Conf.Sync.Provider)
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue