hostinfo: add fly.io detection

Signed-off-by: Denton Gentry <dgentry@tailscale.com>
This commit is contained in:
Denton Gentry 2021-08-08 18:37:37 -07:00 committed by Denton Gentry
parent 0796c53404
commit 26c1183941

View File

@ -28,6 +28,7 @@
Heroku = EnvType("hr") Heroku = EnvType("hr")
AzureAppService = EnvType("az") AzureAppService = EnvType("az")
AWSFargate = EnvType("fg") AWSFargate = EnvType("fg")
FlyDotIo = EnvType("fly")
) )
var envType atomic.Value // of EnvType var envType atomic.Value // of EnvType
@ -57,6 +58,9 @@ func getEnvType() EnvType {
if inAWSFargate() { if inAWSFargate() {
return AWSFargate return AWSFargate
} }
if inFlyDotIo() {
return FlyDotIo
}
return "" return ""
} }
@ -126,3 +130,10 @@ func inAWSFargate() bool {
} }
return false return false
} }
func inFlyDotIo() bool {
if os.Getenv("FLY_APP_NAME") != "" && os.Getenv("FLY_REGION") != "" {
return true
}
return false
}