diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-05-18 11:01:13 +0200 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-05-18 11:01:13 +0200 |
commit | 2c9ae6a5a27ae2f2e23495c613e7a53aed8e786c (patch) | |
tree | b23dbe9051c50a7ed8f666ae71c833fd52823770 /lib/syncthing | |
parent | 51da3506a296b7d5d4185b17364f188292136888 (diff) |
Add Cross SDKs support (part 2)
Diffstat (limited to 'lib/syncthing')
-rw-r--r-- | lib/syncthing/st.go | 2 | ||||
-rw-r--r-- | lib/syncthing/stfolder.go | 14 |
2 files changed, 5 insertions, 11 deletions
diff --git a/lib/syncthing/st.go b/lib/syncthing/st.go index 841901d..957dd65 100644 --- a/lib/syncthing/st.go +++ b/lib/syncthing/st.go @@ -38,6 +38,7 @@ type SyncThing struct { logsDir string exitSTChan chan ExitChan exitSTIChan chan ExitChan + conf *xdsconfig.Config client *common.HTTPClient log *logrus.Logger } @@ -85,6 +86,7 @@ func NewSyncThing(conf *xdsconfig.Config, log *logrus.Logger) *SyncThing { binDir: binDir, logsDir: conf.FileConf.LogsDir, log: log, + conf: conf, } return &s diff --git a/lib/syncthing/stfolder.go b/lib/syncthing/stfolder.go index d79e579..45ac60d 100644 --- a/lib/syncthing/stfolder.go +++ b/lib/syncthing/stfolder.go @@ -4,21 +4,13 @@ import ( "path/filepath" "strings" + "github.com/iotbzh/xds-server/lib/xdsconfig" "github.com/syncthing/syncthing/lib/config" "github.com/syncthing/syncthing/lib/protocol" ) -// FIXME remove and use an interface on xdsconfig.FolderConfig -type FolderChangeArg struct { - ID string - Label string - RelativePath string - SyncThingID string - ShareRootDir string -} - // FolderChange is called when configuration has changed -func (s *SyncThing) FolderChange(f FolderChangeArg) error { +func (s *SyncThing) FolderChange(f xdsconfig.FolderConfig) error { // Get current config stCfg, err := s.ConfigGet() @@ -63,7 +55,7 @@ func (s *SyncThing) FolderChange(f FolderChangeArg) error { folder := config.FolderConfiguration{ ID: id, Label: label, - RawPath: filepath.Join(f.ShareRootDir, f.RelativePath), + RawPath: filepath.Join(s.conf.ShareRootDir, f.RelativePath), } folder.Devices = append(folder.Devices, config.FolderDeviceConfiguration{ |