mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
hostinfo: add an environment type for Replit
Signed-off-by: Anton Tolchanov <anton@tailscale.com>
This commit is contained in:
parent
e8b695626e
commit
586a88c710
@ -139,6 +139,7 @@ func packageTypeCached() string {
|
||||
FlyDotIo = EnvType("fly")
|
||||
Kubernetes = EnvType("k8s")
|
||||
DockerDesktop = EnvType("dde")
|
||||
Replit = EnvType("repl")
|
||||
)
|
||||
|
||||
var envType atomic.Value // of EnvType
|
||||
@ -226,6 +227,9 @@ func getEnvType() EnvType {
|
||||
if inDockerDesktop() {
|
||||
return DockerDesktop
|
||||
}
|
||||
if inReplit() {
|
||||
return Replit
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
@ -313,6 +317,14 @@ func inFlyDotIo() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func inReplit() bool {
|
||||
// https://docs.replit.com/programming-ide/getting-repl-metadata
|
||||
if os.Getenv("REPL_OWNER") != "" && os.Getenv("REPL_SLUG") != "" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func inKubernetes() bool {
|
||||
if os.Getenv("KUBERNETES_SERVICE_HOST") != "" && os.Getenv("KUBERNETES_SERVICE_PORT") != "" {
|
||||
return true
|
||||
|
Loading…
Reference in New Issue
Block a user