// 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
// 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
}
}
// getConfigArrUnsafe Same as GetConfigArr without mutex protection
func (f *Folders) getConfigArrUnsafe() []folder.FolderConfig {
- var conf []folder.FolderConfig
-
+ conf := []folder.FolderConfig{}
for _, v := range f.folders {
conf = append(conf, (*v).GetConfig())
}
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)