From 4b71291cdbfa025a3e8fb978ee954a6d97777c93 Mon Sep 17 00:00:00 2001 From: Denton Gentry Date: Sun, 13 Jun 2021 07:31:52 -0700 Subject: [PATCH] hostinfo: detect when running in Azure App Service. Signed-off-by: Denton Gentry --- control/controlclient/hostinfo_linux.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/control/controlclient/hostinfo_linux.go b/control/controlclient/hostinfo_linux.go index 187e0d36a..6a0c31dde 100644 --- a/control/controlclient/hostinfo_linux.go +++ b/control/controlclient/hostinfo_linux.go @@ -68,6 +68,9 @@ func osVersionLinux() string { if inHerokuDyno() { attrBuf.WriteString("; env=hr") } + if inAzureAppService() { + attrBuf.WriteString("; env=az") + } attr := attrBuf.String() id := m["ID"] @@ -138,6 +141,7 @@ func inAwsLambda() bool { } return false } + func inHerokuDyno() bool { // https://devcenter.heroku.com/articles/dynos#local-environment-variables if os.Getenv("PORT") != "" && os.Getenv("DYNO") != "" { @@ -145,3 +149,11 @@ func inHerokuDyno() bool { } return false } + +func inAzureAppService() bool { + if os.Getenv("APPSVC_RUN_ZIP") != "" && os.Getenv("WEBSITE_STACK") != "" && + os.Getenv("WEBSITE_AUTH_AUTO_AAD") != "" { + return true + } + return false +}