|
|
@ -139,6 +139,7 @@ const (
|
|
|
|
FlyDotIo = EnvType("fly")
|
|
|
|
FlyDotIo = EnvType("fly")
|
|
|
|
Kubernetes = EnvType("k8s")
|
|
|
|
Kubernetes = EnvType("k8s")
|
|
|
|
DockerDesktop = EnvType("dde")
|
|
|
|
DockerDesktop = EnvType("dde")
|
|
|
|
|
|
|
|
Replit = EnvType("repl")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var envType atomic.Value // of EnvType
|
|
|
|
var envType atomic.Value // of EnvType
|
|
|
@ -226,6 +227,9 @@ func getEnvType() EnvType {
|
|
|
|
if inDockerDesktop() {
|
|
|
|
if inDockerDesktop() {
|
|
|
|
return DockerDesktop
|
|
|
|
return DockerDesktop
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if inReplit() {
|
|
|
|
|
|
|
|
return Replit
|
|
|
|
|
|
|
|
}
|
|
|
|
return ""
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -313,6 +317,14 @@ func inFlyDotIo() bool {
|
|
|
|
return false
|
|
|
|
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 {
|
|
|
|
func inKubernetes() bool {
|
|
|
|
if os.Getenv("KUBERNETES_SERVICE_HOST") != "" && os.Getenv("KUBERNETES_SERVICE_PORT") != "" {
|
|
|
|
if os.Getenv("KUBERNETES_SERVICE_HOST") != "" && os.Getenv("KUBERNETES_SERVICE_PORT") != "" {
|
|
|
|
return true
|
|
|
|
return true
|
|
|
|