1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-21 20:07:04 +00:00

able to fetch the ngrok executable path through a 'NGROK' env variable as well, and humanize the returned error

Former-commit-id: 8a61ed64b64e18bd2beb938ccb38150f2090ec54
This commit is contained in:
Gerasimos (Makis) Maropoulos
2019-07-19 12:55:57 +03:00
parent 452b7d2df0
commit ac86d687c3
3 changed files with 21 additions and 17 deletions

View File

@@ -461,7 +461,18 @@ func (tc TunnelingConfiguration) startTunnel(t Tunnel, publicAddr *string) error
if !tc.isNgrokRunning() {
ngrokBin := "ngrok" // environment binary.
if tc.Bin != "" {
if tc.Bin == "" {
_, err := exec.LookPath(ngrokBin)
if err != nil {
ngrokEnvVar, found := os.LookupEnv("NGROK")
if !found {
return fmt.Errorf(`"ngrok" executable not found, please install it from: https://ngrok.com/download`)
}
ngrokBin = ngrokEnvVar
}
} else {
ngrokBin = tc.Bin
}