Skip to content

Commit

Permalink
hostinfo: add Home Assistant Add-On detection (tailscale#8857)
Browse files Browse the repository at this point in the history
Fixes tailscale#8856

Signed-off-by: Shayne Sweeney <shayne@tailscale.com>
Signed-off-by: Alex Paguis <alex@windscribe.com>
  • Loading branch information
shayne authored and alexelisenko committed Feb 15, 2024
1 parent ff2f163 commit e12f5b1
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions hostinfo/hostinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -255,6 +256,9 @@ func getEnvType() EnvType {
if inReplit() {
return Replit
}
if inHomeAssistantAddOn() {
return HomeAssistantAddOn
}
return ""
}

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit e12f5b1

Please sign in to comment.