Set install dir to /opt/AGL and move conf to $HOME/.xds-server
[src/xds/xds-server.git] / lib / syncthing / st.go
index b622970..c76db5a 100644 (file)
@@ -27,12 +27,13 @@ import (
 
 // SyncThing .
 type SyncThing struct {
-       BaseURL string
-       APIKey  string
-       Home    string
-       STCmd   *exec.Cmd
-       STICmd  *exec.Cmd
-       MyID    string
+       BaseURL   string
+       APIKey    string
+       Home      string
+       STCmd     *exec.Cmd
+       STICmd    *exec.Cmd
+       MyID      string
+       Connected bool
 
        // Private fields
        binDir      string
@@ -113,7 +114,7 @@ func NewSyncThing(conf *xdsconfig.Config, log *logrus.Logger) *SyncThing {
 
        if binDir == "" {
                if binDir, err = filepath.Abs(filepath.Dir(os.Args[0])); err != nil {
-                       binDir = "/usr/local/bin"
+                       binDir = "/opt/AGL/bin"
                }
        }
 
@@ -301,6 +302,7 @@ func (s *SyncThing) StopInotify() {
 // Connect Establish HTTP connection with Syncthing
 func (s *SyncThing) Connect() error {
        var err error
+       s.Connected = false
        s.client, err = common.HTTPNewClient(s.BaseURL,
                common.HTTPClientConfig{
                        URLPrefix:           "/rest",
@@ -327,6 +329,8 @@ func (s *SyncThing) Connect() error {
                return fmt.Errorf("ERROR: cannot retrieve ID")
        }
 
+       s.Connected = true
+
        // Start events monitoring
        err = s.Events.Start()