⬆️ Configured for support dealer

This commit is contained in:
LittleSheep 2024-07-16 18:09:18 +08:00
parent c912271610
commit cef0a552f4
4 changed files with 10 additions and 10 deletions

View File

@ -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)

View File

@ -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")
{

View File

@ -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")),

View File

@ -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"