mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
cmd/syncthing: Fix upgrade of running syncthing from CLI (fixes #3193)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3198
This commit is contained in:
parent
4453236949
commit
7373d2eb3c
@ -17,8 +17,10 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
_ "net/http/pprof"
|
_ "net/http/pprof"
|
||||||
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
@ -476,8 +478,13 @@ func performUpgrade(release upgrade.Release) {
|
|||||||
|
|
||||||
func upgradeViaRest() error {
|
func upgradeViaRest() error {
|
||||||
cfg, _ := loadConfig()
|
cfg, _ := loadConfig()
|
||||||
target := cfg.GUI().URL()
|
u, err := url.Parse(cfg.GUI().URL())
|
||||||
r, _ := http.NewRequest("POST", target+"/rest/system/upgrade", nil)
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
u.Path = path.Join(u.Path, "rest/system/upgrade")
|
||||||
|
target := u.String()
|
||||||
|
r, _ := http.NewRequest("POST", target, nil)
|
||||||
r.Header.Set("X-API-Key", cfg.GUI().APIKey)
|
r.Header.Set("X-API-Key", cfg.GUI().APIKey)
|
||||||
|
|
||||||
tr := &http.Transport{
|
tr := &http.Transport{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user