X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=lib%2Fmodel%2Ffolders.go;fp=lib%2Fmodel%2Ffolders.go;h=576c4a25340c8e1924ed59d63c1eeeceadf7185e;hb=f7901489d13c90c0f4d4273e93eacc990087e6b8;hp=7c08a88b73d5257991bebe98860e4ce43910829d;hpb=1966f9e786dfb67543401d181a374bd7f3856f37;p=src%2Fxds%2Fxds-server.git diff --git a/lib/model/folders.go b/lib/model/folders.go index 7c08a88..576c4a2 100644 --- a/lib/model/folders.go +++ b/lib/model/folders.go @@ -78,6 +78,8 @@ func (f *Folders) LoadConfig() error { // Don't exit on such error, just log it f.Log.Errorf(err.Error()) } + } else { + f.Log.Infof("Syncthing support is disabled.") } // Merge syncthing folders into XDS folders @@ -101,20 +103,22 @@ func (f *Folders) LoadConfig() error { // Detect ghost project // (IOW existing in xds file config and not in syncthing database) - for i, xf := range flds { - // only for syncthing project - if xf.Type != folder.TypeCloudSync { - continue - } - found := false - for _, stf := range stFlds { - if stf.ID == xf.ID { - found = true - break + if f.SThg != nil { + for i, xf := range flds { + // only for syncthing project + if xf.Type != folder.TypeCloudSync { + continue + } + found := false + for _, stf := range stFlds { + if stf.ID == xf.ID { + found = true + break + } + } + if !found { + flds[i].Status = folder.StatusErrorConfig } - } - if !found { - flds[i].Status = folder.StatusErrorConfig } } @@ -196,10 +200,13 @@ func (f *Folders) createUpdate(newF folder.FolderConfig, create bool, initial bo switch newF.Type { // SYNCTHING case folder.TypeCloudSync: - if f.SThg == nil { - return nil, fmt.Errorf("CloudSync type not supported (syncthing not initialized)") + if f.SThg != nil { + fld = f.SThg.NewFolderST(f.Conf) + } else { + f.Log.Debugf("Disable project %v (syncthing not initialized)", newF.ID) + fld = folder.NewFolderSTDisable(f.Conf) } - fld = f.SThg.NewFolderST(f.Conf) + // PATH MAP case folder.TypePathMap: fld = folder.NewFolderPathMap(f.Conf)