refactor: rename Hermes API to Admin API v2 under /api/v2
Integrates the external API into the existing /api group as v2 with API key auth (ADMIN_API_KEY), replacing the separate /hermes namespace. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
f8d44f3c21
commit
9fd0772e91
@@ -262,8 +262,8 @@ func AuthAdmin(c *fiber.Ctx) error {
|
||||
|
||||
func AuthApi() func(*fiber.Ctx) error {
|
||||
return func(c *fiber.Ctx) error {
|
||||
// Excluir rutas públicas
|
||||
if c.Path() == "/api/v1/oauth/token" || c.Path() == "/api/sms/send" {
|
||||
// Excluir rutas públicas y /api/v2 (tiene su propio middleware)
|
||||
if c.Path() == "/api/v1/oauth/token" || c.Path() == "/api/sms/send" || strings.HasPrefix(c.Path(), "/api/v2") {
|
||||
return c.Next()
|
||||
}
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func HermesAuth() fiber.Handler {
|
||||
func AdminApiAuth() fiber.Handler {
|
||||
return func(c *fiber.Ctx) error {
|
||||
apiKey := os.Getenv("HERMES_API_KEY")
|
||||
apiKey := os.Getenv("ADMIN_API_KEY")
|
||||
if apiKey == "" {
|
||||
return c.Status(503).JSON(fiber.Map{"error": "HERMES_API_KEY not configured"})
|
||||
return c.Status(503).JSON(fiber.Map{"error": "ADMIN_API_KEY not configured"})
|
||||
}
|
||||
|
||||
token := ""
|
||||
|
||||
Reference in New Issue
Block a user