use os.Executable to discover the path to cloudflared

This commit is contained in:
Alex Vanderpot 2023-08-08 07:55:56 -07:00
parent 5f3cfe044f
commit 0b46669eb5
1 changed files with 5 additions and 0 deletions

View File

@ -466,6 +466,11 @@ func processURL(s string) (*url.URL, error) {
// cloudflaredPath pulls the full path of cloudflared on disk
func cloudflaredPath() string {
path, err := os.Executable()
if err == nil && isFileThere(path) {
return path
}
for _, p := range strings.Split(os.Getenv("PATH"), ":") {
path := fmt.Sprintf("%s/%s", p, "cloudflared")
if isFileThere(path) {