summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorshayne <shayne@tailscale.com>2023-08-11 15:55:01 -0400
committerGitHub <noreply@github.com>2023-08-11 15:55:01 -0400
commitcc3caa4b2ac3e102c453f4268d288183e4cba693 (patch)
treefd363ee35d742bfd65a0fc890447d5a5a6f14a6e
parentde8e55fda6c61406d310be67761e2e4bc08ae874 (diff)
downloadtailscale-cc3caa4b2ac3e102c453f4268d288183e4cba693.tar.xz
tailscale-cc3caa4b2ac3e102c453f4268d288183e4cba693.zip
hostinfo: add Home Assistant Add-On detection (#8857)
Fixes #8856 Signed-off-by: Shayne Sweeney <shayne@tailscale.com>
-rw-r--r--hostinfo/hostinfo.go29
1 files changed, 20 insertions, 9 deletions
diff --git a/hostinfo/hostinfo.go b/hostinfo/hostinfo.go
index 65fd676a8..ebe0ed440 100644
--- a/hostinfo/hostinfo.go
+++ b/hostinfo/hostinfo.go
@@ -141,15 +141,16 @@ func packageTypeCached() string {
type EnvType string
const (
- KNative = EnvType("kn")
- AWSLambda = EnvType("lm")
- Heroku = EnvType("hr")
- AzureAppService = EnvType("az")
- AWSFargate = EnvType("fg")
- FlyDotIo = EnvType("fly")
- Kubernetes = EnvType("k8s")
- DockerDesktop = EnvType("dde")
- Replit = EnvType("repl")
+ KNative = EnvType("kn")
+ AWSLambda = EnvType("lm")
+ Heroku = EnvType("hr")
+ AzureAppService = EnvType("az")
+ AWSFargate = EnvType("fg")
+ FlyDotIo = EnvType("fly")
+ Kubernetes = EnvType("k8s")
+ DockerDesktop = EnvType("dde")
+ Replit = EnvType("repl")
+ HomeAssistantAddOn = EnvType("haao")
)
var envType atomic.Value // of EnvType
@@ -255,6 +256,9 @@ func getEnvType() EnvType {
if inReplit() {
return Replit
}
+ if inHomeAssistantAddOn() {
+ return HomeAssistantAddOn
+ }
return ""
}
@@ -364,6 +368,13 @@ func inDockerDesktop() bool {
return false
}
+func inHomeAssistantAddOn() bool {
+ if os.Getenv("SUPERVISOR_TOKEN") != "" || os.Getenv("HASSIO_TOKEN") != "" {
+ return true
+ }
+ return false
+}
+
// goArchVar returns the GOARM or GOAMD64 etc value that the binary was built
// with.
func goArchVar() string {