mirror of
https://github.com/azukaar/Cosmos-Server.git
synced 2026-05-24 22:38:30 -05:00
[release] v0.16.0-unstable29
This commit is contained in:
+12
-10
@@ -920,18 +920,20 @@ func GetEnv(env []string, key string) string {
|
||||
}
|
||||
|
||||
func IsInsideContainer() {
|
||||
errD := Connect()
|
||||
if errD != nil {
|
||||
utils.Error("isInsideContainer", errD)
|
||||
return
|
||||
}
|
||||
if os.Getenv("HOSTNAME") != "" {
|
||||
errD := Connect()
|
||||
if errD != nil {
|
||||
utils.Error("isInsideContainer", errD)
|
||||
return
|
||||
}
|
||||
|
||||
container, err := DockerClient.ContainerInspect(DockerContext, os.Getenv("HOSTNAME"))
|
||||
container, err := DockerClient.ContainerInspect(DockerContext, os.Getenv("HOSTNAME"))
|
||||
|
||||
if err == nil {
|
||||
// check image
|
||||
if strings.Contains(container.Config.Image, "cosmos") {
|
||||
utils.IsInsideContainer = true
|
||||
if err == nil {
|
||||
// check image
|
||||
if strings.Contains(container.Config.Image, "cosmos") {
|
||||
utils.IsInsideContainer = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user