mirror of
https://github.com/yanislav-igonin/micrach
synced 2025-04-20 03:40:33 +03:00
19 lines
332 B
Go
19 lines
332 B
Go
![]() |
package controllers
|
||
|
|
||
|
import (
|
||
|
Config "micrach/config"
|
||
|
|
||
|
"github.com/gin-gonic/gin"
|
||
|
)
|
||
|
|
||
|
func Ping(c *gin.Context) {
|
||
|
headerKey := c.Request.Header.Get("Authorization")
|
||
|
if Config.App.Gateway.ApiKey != headerKey {
|
||
|
c.AbortWithStatusJSON(401, gin.H{"error": "Unauthorized"})
|
||
|
return
|
||
|
}
|
||
|
c.JSON(200, gin.H{
|
||
|
"message": "pong",
|
||
|
})
|
||
|
}
|