From cef0a552f46c93b7eb983da6d3cd872ca481e4c9 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 16 Jul 2024 18:09:18 +0800 Subject: [PATCH] :arrow_up: Configured for support dealer --- pkg/internal/server/admin/index.go | 4 ++-- pkg/internal/server/api/index.go | 4 ++-- pkg/internal/server/server.go | 11 ++++++----- settings.toml | 1 - 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/internal/server/admin/index.go b/pkg/internal/server/admin/index.go index 942b1c8..ba4986a 100644 --- a/pkg/internal/server/admin/index.go +++ b/pkg/internal/server/admin/index.go @@ -4,8 +4,8 @@ import ( "github.com/gofiber/fiber/v2" ) -func MapAdminAPIs(app *fiber.App) { - admin := app.Group("/api/admin") +func MapAdminAPIs(app *fiber.App, baseURL string) { + admin := app.Group(baseURL) { admin.Post("/badges", grantBadge) admin.Delete("/badges/:badgeId", revokeBadge) diff --git a/pkg/internal/server/api/index.go b/pkg/internal/server/api/index.go index a1dc76f..6229d13 100644 --- a/pkg/internal/server/api/index.go +++ b/pkg/internal/server/api/index.go @@ -4,10 +4,10 @@ import ( "github.com/gofiber/fiber/v2" ) -func MapAPIs(app *fiber.App) { +func MapAPIs(app *fiber.App, baseURL string) { app.Get("/.well-known/openid-configuration", getOidcConfiguration) - api := app.Group("/api").Name("API") + api := app.Group(baseURL).Name("API") { notify := api.Group("/notifications").Name("Notifications API") { diff --git a/pkg/internal/server/server.go b/pkg/internal/server/server.go index d52a1b1..23f1c69 100644 --- a/pkg/internal/server/server.go +++ b/pkg/internal/server/server.go @@ -1,13 +1,14 @@ package server import ( + "net/http" + "path/filepath" + "strings" + "git.solsynth.dev/hydrogen/passport/pkg/internal/server/admin" "git.solsynth.dev/hydrogen/passport/pkg/internal/server/api" "git.solsynth.dev/hydrogen/passport/pkg/internal/server/exts" "github.com/gofiber/fiber/v2/middleware/filesystem" - "net/http" - "path/filepath" - "strings" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/cors" @@ -59,8 +60,8 @@ func NewServer() *HTTPApp { app.Use(exts.AuthMiddleware) - admin.MapAdminAPIs(app) - api.MapAPIs(app) + admin.MapAdminAPIs(app, "/api/admin") + api.MapAPIs(app, "/api") app.Use(filesystem.New(filesystem.Config{ Root: http.Dir(viper.GetString("frontend_app")), diff --git a/settings.toml b/settings.toml index 0d38586..fad752a 100644 --- a/settings.toml +++ b/settings.toml @@ -6,7 +6,6 @@ frontend_app = "web/dist" bind = "0.0.0.0:8444" grpc_bind = "0.0.0.0:7444" domain = "localhost" -secret = "LtTjzAGFLshwXhN4ZD4nG5KlMv1MWcsvfv03TSZYnT1VhiAnLIZFTnHUwR0XhGgi" content_endpoint = "https://usercontent.solsynth.dev"