2022-02-28 10:18:44 +03:00
|
|
|
package gateway
|
|
|
|
|
|
|
|
import (
|
2022-04-09 15:16:09 +03:00
|
|
|
"micrach/config"
|
2022-02-28 10:18:44 +03:00
|
|
|
|
2022-04-09 15:16:09 +03:00
|
|
|
"github.com/gofiber/fiber/v2"
|
2022-02-28 10:18:44 +03:00
|
|
|
)
|
|
|
|
|
2022-04-09 15:16:09 +03:00
|
|
|
func Ping(c *fiber.Ctx) error {
|
|
|
|
headerKey := c.GetReqHeaders()["Authorization"]
|
|
|
|
if config.App.Gateway.ApiKey != headerKey {
|
|
|
|
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{"error": "Unauthorized"})
|
2022-02-28 10:18:44 +03:00
|
|
|
}
|
2022-04-09 15:16:09 +03:00
|
|
|
return c.JSON(fiber.Map{
|
2022-02-28 10:18:44 +03:00
|
|
|
"message": "pong",
|
|
|
|
})
|
|
|
|
}
|