diff --git a/configtools.go b/configtools.go index adfc333bac17c161610ae9531e1c8a9d2aff43b2..af1caf75c5204587e835b7e8705677f4c1f23047 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) }