mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
fix healthz endpoint when AMQP is disabled
This commit is contained in:
parent
a3b99dbd04
commit
49fe2e6e1f
1 changed files with 6 additions and 6 deletions
|
@ -54,11 +54,8 @@ func getHealth(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if connection to AMQP broker is alive if backend was started with AMQP client
|
// check if connection to AMQP broker is alive if backend was started with AMQP client
|
||||||
url, err := configuration.GlobalConfig.StringOr("amqp.host", "not-set")
|
url, err := configuration.GlobalConfig.StringOr("amqp.host", "")
|
||||||
if err != nil && url == "not-set" {
|
if err != nil {
|
||||||
c.JSON(http.StatusOK, gin.H{})
|
|
||||||
return
|
|
||||||
} else if err != nil {
|
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{
|
c.JSON(http.StatusInternalServerError, gin.H{
|
||||||
"success:": false,
|
"success:": false,
|
||||||
"message": err.Error(),
|
"message": err.Error(),
|
||||||
|
@ -66,7 +63,10 @@ func getHealth(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(url) != 0 {
|
if url == "" {
|
||||||
|
c.Writer.WriteHeader(http.StatusNoContent)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
err = helper.CheckConnection()
|
err = helper.CheckConnection()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err.Error())
|
log.Println(err.Error())
|
||||||
|
|
Loading…
Add table
Reference in a new issue