From e854e15f1a3a25dd5105809686050ddeae1fdba4 Mon Sep 17 00:00:00 2001
From: Jose Carlos Luna <Jose.Carlos.Luna@cern.ch>
Date: Fri, 10 May 2024 16:36:08 +0200
Subject: [PATCH] Changed how the executable path is found

---
 configtools.go | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/configtools.go b/configtools.go
index adfc333..af1caf7 100644
--- a/configtools.go
+++ b/configtools.go
@@ -2,8 +2,9 @@ package main
 
 import (
 	"fmt"
+	"log"
+	"os"
 	"path"
-	"runtime"
 	"strings"
 
 	"github.com/spf13/cobra"
@@ -81,8 +82,11 @@ func init() {
 	gocanaryCmd.PersistentFlags().StringArrayVar(&domains, "domain", []string{}, "Only respond to this domain (can be specified multiple times)")
 	gocanaryCmd.PersistentFlags().StringArrayVar(&autocertDomains, "autocert-domain", []string{}, "Enable let's encrypt autocertificate (can be specified multiple times), this will ignore https-cert and http-key options")
 
-	_, filename, _, _ := runtime.Caller(1)
-	binPath = path.Dir(filename)
+	exePath, err := os.Executable()
+	if err != nil {
+		log.Fatalf("Cannot find own binpath")
+	}
+	binPath = path.Dir(exePath)
 
 }
 
-- 
GitLab