fix: tray app infers UI port from BACKREST_PORT or --bind-address if available

This commit is contained in:
Gareth George
2024-11-26 00:26:17 -08:00
parent 4f03427c91
commit c810d27375
+10 -1
View File
@@ -6,6 +6,7 @@ package main
import (
"context"
"fmt"
"net"
"os"
"os/exec"
"path/filepath"
@@ -52,7 +53,15 @@ func main() {
mOpenUI.ClickedCh = make(chan struct{})
go func() {
for range mOpenUI.ClickedCh {
if err := openBrowser("http://localhost:9898"); err != nil {
bindaddr := env.BindAddress()
if bindaddr == "" {
bindaddr = ":9898"
}
_, port, err := net.SplitHostPort(bindaddr)
if err != nil {
port = "9898" // try the default
}
if err := openBrowser(fmt.Sprintf("http://localhost:%v", port)); err != nil {
reportError(err)
}
}