if err != nil {
return cli.NewExitError(err, 2)
}
- ctx.Log.Infof("Syncthing started (PID %d)", ctx.SThgCmd.Process.Pid)
+ fmt.Printf("Syncthing started (PID %d)\n", ctx.SThgCmd.Process.Pid)
ctx.Log.Infof("Starting Syncthing-inotify...")
ctx.SThgInotCmd, err = ctx.SThg.StartInotify()
if err != nil {
return cli.NewExitError(err, 2)
}
- ctx.Log.Infof("Syncthing-inotify started (PID %d)", ctx.SThgInotCmd.Process.Pid)
+ fmt.Printf("Syncthing-inotify started (PID %d)\n", ctx.SThgInotCmd.Process.Pid)
// Establish connection with local Syncthing (retry if connection fail)
+ fmt.Printf("Establishing connection with Syncthing...\n")
time.Sleep(2 * time.Second)
- retry := 10
+ maxRetry := 30
+ retry := maxRetry
err = nil
for retry > 0 {
if err = ctx.SThg.Connect(); err == nil {
break
}
- ctx.Log.Warningf("Establishing connection to Syncthing (retry %d/10)", retry)
+ ctx.Log.Warningf("Establishing connection to Syncthing (retry %d/%d)", retry, maxRetry)
time.Sleep(time.Second)
retry--
}
return cli.NewExitError(err, 2)
}
for _, stFld := range stCfg.Folders {
- relativePath := strings.TrimPrefix(stFld.RawPath, ctx.Config.ShareRootDir)
+ relativePath := strings.TrimPrefix(stFld.RawPath, ctx.Config.FileConf.ShareRootDir)
if relativePath == "" {
relativePath = stFld.RawPath
}
- newFld := xdsconfig.NewFolderConfig(stFld.ID, stFld.Label, ctx.Config.ShareRootDir, strings.Trim(relativePath, "/"), defaultSdk)
+ newFld := xdsconfig.NewFolderConfig(stFld.ID,
+ stFld.Label,
+ ctx.Config.FileConf.ShareRootDir,
+ strings.TrimRight(relativePath, "/"),
+ defaultSdk)
ctx.Config.Folders = ctx.Config.Folders.Update(xdsconfig.FoldersConfig{newFld})
}