Skip to content

Commit

Permalink
fix: tray app infers UI port from BACKREST_PORT or --bind-address if …
Browse files Browse the repository at this point in the history
…available
  • Loading branch information
garethgeorge committed Nov 26, 2024
1 parent 4f03427 commit c810d27
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cmd/backrestmon/backrestmon.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package main
import (
"context"
"fmt"
"net"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -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)
}
}
Expand Down

0 comments on commit c810d27

Please sign in to comment.