Fixed IPC calls in main to use new ip and port seperation in the config

This commit is contained in:
2026-06-06 23:42:54 -05:00
parent c3e17f9a80
commit 988bdfcf6c
3 changed files with 16 additions and 9 deletions

10
main.go
View File

@@ -63,6 +63,9 @@ func main() {
log.Fatalf("Initialization failed: %v", err)
}
listenAddress := cfg.Daemon.ListenAddress + ":" + strconv.Itoa(cfg.Daemon.Port)
fmt.Printf("Got listen address from config: %s\n", listenAddress)
subCommand := args[0]
switch subCommand {
@@ -132,7 +135,9 @@ func main() {
}
func sendIPCRequest(cfg *AppConfig, method string, path string, body io.Reader) {
targetUrl := fmt.Sprintf("http://%s%s", cfg.Daemon.ListenAddress, path)
listenAddress := cfg.Daemon.ListenAddress + ":" + strconv.Itoa(cfg.Daemon.Port)
targetUrl := fmt.Sprintf("http://%s%s", listenAddress, path)
fmt.Printf("Listen Addr: %s; Target URL: %s\n", listenAddress, targetUrl)
req, err := http.NewRequest(method, targetUrl, body)
if err != nil {
log.Fatalf("Failed to construct IPC frame: %v", err)
@@ -158,7 +163,8 @@ func sendIPCRequest(cfg *AppConfig, method string, path string, body io.Reader)
}
func fetchAndPrintStatus(cfg *AppConfig) {
targetUrl := fmt.Sprintf("http://%s/instances/list", cfg.Daemon.ListenAddress)
listenAddress := cfg.Daemon.ListenAddress + ":" + strconv.Itoa(cfg.Daemon.Port)
targetUrl := fmt.Sprintf("http://%s/instances/list", listenAddress)
resp, err := http.Get(targetUrl)
if err != nil {
log.Fatalf("IPC connection failed. Is the vs-manager daemon running? Error: %v", err)