fix for updating older agents

This commit is contained in:
Thomas Quandalle
2022-06-23 11:14:57 +02:00
parent bf72070d51
commit 85393e8e4b
+4 -4
View File
@@ -33,10 +33,7 @@ func AddRoutes(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware, configuratio
var conf models.Config
c.BindJSON(&conf)
if os.Getenv("DEPLOYMENT") == "" || os.Getenv("DEPLOYMENT") == "agent" {
res, _ := json.MarshalIndent(conf, "", "\t")
ioutil.WriteFile("./data/config/config.json", res, 0644)
} else if os.Getenv("DEPLOYMENT") == "factory" {
if os.Getenv("DEPLOYMENT") == "factory" || os.Getenv("MACHINERY_ENVIRONMENT") == "kubernetes" {
// Write to mongodb
session := database.New().Copy()
defer session.Close()
@@ -47,6 +44,9 @@ func AddRoutes(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware, configuratio
"type": "config",
"name": os.Getenv("DEPLOYMENT_NAME"),
}, &conf)
} else if os.Getenv("DEPLOYMENT") == "" || os.Getenv("DEPLOYMENT") == "agent" {
res, _ := json.MarshalIndent(conf, "", "\t")
ioutil.WriteFile("./data/config/config.json", res, 0644)
}
select {