diff options
Diffstat (limited to 'lib/syncthing')
-rw-r--r-- | lib/syncthing/st.go | 8 | ||||
-rw-r--r-- | lib/syncthing/stEvent.go | 2 | ||||
-rw-r--r-- | lib/syncthing/stfolder.go | 33 |
3 files changed, 16 insertions, 27 deletions
diff --git a/lib/syncthing/st.go b/lib/syncthing/st.go index 304cfca..924f407 100644 --- a/lib/syncthing/st.go +++ b/lib/syncthing/st.go @@ -119,7 +119,7 @@ func NewSyncThing(conf *xdsconfig.Config, log *logrus.Logger) *SyncThing { } // Create Events monitoring - // SEB TO TEST s.Events = s.NewEventListener() + s.Events = s.NewEventListener() return &s } @@ -130,7 +130,7 @@ func (s *SyncThing) startProc(exeName string, args []string, env []string, eChan var exePath string // Kill existing process (useful for debug ;-) ) - if os.Getenv("DEBUG_MODE") != "" { + if _, dbg := os.LookupEnv("XDS_DEBUG_MODE"); dbg { fmt.Printf("\n!!! DEBUG_MODE set: KILL existing %s process(es) !!!\n", exeName) exec.Command("bash", "-c", "ps -ax |grep "+exeName+" |grep "+s.BaseURL+" |cut -d' ' -f 1|xargs -I{} kill -9 {}").Output() } @@ -227,7 +227,7 @@ func (s *SyncThing) Start() (*exec.Cmd, error) { "STNOUPGRADE=1", } - /* SEB STILL NEEDED, if not SUP code + /* FIXME - STILL NEEDED ?, if not SUP code // XXX - temporary hack because -gui-apikey seems to correctly handle by // syncthing the early first time @@ -371,7 +371,7 @@ func (s *SyncThing) Connect() error { s.Connected = true // Start events monitoring - //SEB TODO err = s.Events.Start() + err = s.Events.Start() return err } diff --git a/lib/syncthing/stEvent.go b/lib/syncthing/stEvent.go index 9ca8b78..0017555 100644 --- a/lib/syncthing/stEvent.go +++ b/lib/syncthing/stEvent.go @@ -66,7 +66,7 @@ type cbMap struct { // NewEventListener Create a new instance of Event listener func (s *SyncThing) NewEventListener() *Events { - _, dbg := os.LookupEnv("XDS_DEBUG_STEVENTS") // set to add more debug log + _, dbg := os.LookupEnv("XDS_LOG_SILLY_STEVENTS") // set to add more debug log return &Events{ MonitorTime: 100, // in Milliseconds Debug: dbg, diff --git a/lib/syncthing/stfolder.go b/lib/syncthing/stfolder.go index 2ad6859..196e3c7 100644 --- a/lib/syncthing/stfolder.go +++ b/lib/syncthing/stfolder.go @@ -6,22 +6,21 @@ import ( "strings" common "github.com/iotbzh/xds-common/golib" - "github.com/iotbzh/xds-server/lib/folder" stconfig "github.com/syncthing/syncthing/lib/config" "github.com/syncthing/syncthing/lib/protocol" ) -// FIXME remove and use an interface on xdsconfig.FolderConfig +// FolderChangeArg argument structure used by FolderChange type FolderChangeArg struct { ID string Label string RelativePath string SyncThingID string - ShareRootDir string } // FolderLoadFromStConfig Load/Retrieve folder config from syncthing database -func (s *SyncThing) FolderLoadFromStConfig(f *[]folder.FolderConfig) error { +/* +func (s *SyncThing) FolderLoadFromStConfig(f *[]XdsFolderConfig) error { defaultSdk := "" // cannot know which was the default sdk @@ -41,26 +40,21 @@ func (s *SyncThing) FolderLoadFromStConfig(f *[]folder.FolderConfig) error { } for _, stFld := range stCfg.Folders { - /* - cliPath := strings.TrimPrefix(stFld.Path, s.conf.FileConf.ShareRootDir) - if cliPath == "" { - cliPath = stFld.Path - }*/ - cliPath := stFld.Path - *f = append(*f, folder.FolderConfig{ + *f = append(*f, XdsFolderConfig{ ID: stFld.ID, Label: stFld.Label, - ClientPath: strings.TrimRight(cliPath, "/"), - Type: folder.TypeCloudSync, - Status: folder.StatusDisable, + ClientPath: strings.TrimRight(stFld.Path, "/"), + Type: XdsTypeCloudSync, + Status: StatusDisable, DefaultSdk: defaultSdk, - RootPath: "", //s.conf.FileConf.ShareRootDir, - DataCloudSync: folder.CloudSyncConfig{SyncThingID: devID}, + RootPath: "", + DataCloudSync: XdsCloudSyncConfig{SyncThingID: devID}, }) } return nil } +*/ // FolderChange is called when configuration has changed func (s *SyncThing) FolderChange(f FolderChangeArg) (string, error) { @@ -111,8 +105,6 @@ func (s *SyncThing) FolderChange(f FolderChangeArg) (string, error) { if err != nil { pathCli = f.RelativePath } - // SEB still need ShareRootDir ? a sup - // pathCli := filepath.Join(f.ShareRootDir, f.RelativePath) folder := stconfig.FolderConfiguration{ ID: id, @@ -146,11 +138,8 @@ func (s *SyncThing) FolderChange(f FolderChangeArg) (string, error) { } err = s.ConfigSet(stCfg) - if err != nil { - s.log.Errorln(err) - } - return id, nil + return id, err } // FolderDelete is called to delete a folder config |