Serve frontend with embed
All checks were successful
release-nightly / build-docker (push) Successful in 3m2s

This commit is contained in:
LittleSheep 2024-01-30 18:55:55 +08:00
parent 6d056b6e1d
commit 769ce23897

View File

@ -1,10 +1,13 @@
package server
import (
"code.smartsheep.studio/hydrogen/passport/pkg/view"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/filesystem"
jsoniter "github.com/json-iterator/go"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
"net/http"
)
var A *fiber.App
@ -17,8 +20,16 @@ func NewServer() {
AppName: "Hydrogen.Passport",
JSONEncoder: jsoniter.ConfigCompatibleWithStandardLibrary.Marshal,
JSONDecoder: jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal,
EnablePrintRoutes: viper.GetBool("debug"),
})
A.Use("/", filesystem.New(filesystem.Config{
Root: http.FS(view.FS),
PathPrefix: "dist",
Index: "index.html",
NotFoundFile: "index.html",
}))
A.Get("/.well-known", getMetadata)
A.Get("/.well-known/openid-configuration", getOidcConfiguration)