mirror of
https://github.com/yanislav-igonin/micrach
synced 2026-07-27 05:14:17 +03:00
* chore: add agents md * docs: expand repository and setup guides * docs: plan project modernization * docs: add Wave 1 implementation plan * test: characterize legacy behavior * build: update Go and Fiber v2 * fix(gateway): preserve duplicate auth behavior * refactor(db): migrate to pgx v5 * refactor: replace deprecated I/O APIs * build: add local PostgreSQL compose * build: add multi-stage image * ci: replace legacy deployment workflow * fix(deps): update vulnerable Go modules * docs: document modern development workflow
22 lines
445 B
Go
22 lines
445 B
Go
package gateway
|
|
|
|
import (
|
|
"micrach/config"
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
func Ping(c *fiber.Ctx) error {
|
|
headerValues := c.GetReqHeaders()["Authorization"]
|
|
headerKey := ""
|
|
if len(headerValues) > 0 {
|
|
headerKey = headerValues[len(headerValues)-1]
|
|
}
|
|
if config.App.Gateway.ApiKey != headerKey {
|
|
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{"error": "Unauthorized"})
|
|
}
|
|
return c.JSON(fiber.Map{
|
|
"message": "pong",
|
|
})
|
|
}
|