From 26c1183941029cd4989bdcc3eab126df19902a14 Mon Sep 17 00:00:00 2001 From: Denton Gentry Date: Sun, 8 Aug 2021 18:37:37 -0700 Subject: [PATCH] hostinfo: add fly.io detection Signed-off-by: Denton Gentry --- hostinfo/hostinfo.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hostinfo/hostinfo.go b/hostinfo/hostinfo.go index 58c8e9de3..794b383af 100644 --- a/hostinfo/hostinfo.go +++ b/hostinfo/hostinfo.go @@ -28,6 +28,7 @@ const ( Heroku = EnvType("hr") AzureAppService = EnvType("az") AWSFargate = EnvType("fg") + FlyDotIo = EnvType("fly") ) var envType atomic.Value // of EnvType @@ -57,6 +58,9 @@ func getEnvType() EnvType { if inAWSFargate() { return AWSFargate } + if inFlyDotIo() { + return FlyDotIo + } return "" } @@ -126,3 +130,10 @@ func inAWSFargate() bool { } return false } + +func inFlyDotIo() bool { + if os.Getenv("FLY_APP_NAME") != "" && os.Getenv("FLY_REGION") != "" { + return true + } + return false +}