mirror of
https://github.com/yanislav-igonin/micrach
synced 2024-12-22 14:22:33 +03:00
79e6cc8e5b
* feat: add geateway config * feat: add ping controller for check by gateway * feat: add new env vars for gateway * feat: update config * gateway request wip * feat: add auth header for gateway request * feat: separate gateway folder * update endpoint for gateway * add makefile * lint * swap png to svg * add url of board to request to gateway * change deployed path prefix * add env in compose * add body log on gateway connect
20 lines
360 B
Go
20 lines
360 B
Go
package gateway
|
|
|
|
import (
|
|
Config "micrach/config"
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func Ping(c *gin.Context) {
|
|
headerKey := c.Request.Header.Get("Authorization")
|
|
if Config.App.Gateway.ApiKey != headerKey {
|
|
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"error": "Unauthorized"})
|
|
return
|
|
}
|
|
c.JSON(200, gin.H{
|
|
"message": "pong",
|
|
})
|
|
}
|