// 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
if binDir == "" {
if binDir, err = filepath.Abs(filepath.Dir(os.Args[0])); err != nil {
- binDir = "/usr/local/bin"
+ binDir = "/opt/AGL/bin"
}
}
// 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",
return fmt.Errorf("ERROR: cannot retrieve ID")
}
+ s.Connected = true
+
// Start events monitoring
err = s.Events.Start()