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
|
||||
url, err := configuration.GlobalConfig.StringOr("amqp.host", "not-set")
|
||||
if err != nil && url == "not-set" {
|
||||
c.JSON(http.StatusOK, gin.H{})
|
||||
return
|
||||
} else if err != nil {
|
||||
url, err := configuration.GlobalConfig.StringOr("amqp.host", "")
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{
|
||||
"success:": false,
|
||||
"message": err.Error(),
|
||||
|
@ -66,7 +63,10 @@ func getHealth(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if len(url) != 0 {
|
||||
if url == "" {
|
||||
c.Writer.WriteHeader(http.StatusNoContent)
|
||||
return
|
||||
} else {
|
||||
err = helper.CheckConnection()
|
||||
if err != nil {
|
||||
log.Println(err.Error())
|
||||
|
|
Loading…
Add table
Reference in a new issue