mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-04 02:11:40 +00:00
fix: update Schema service to use new API endpoint
This commit is contained in:
@@ -1,22 +1,16 @@
|
||||
package nebula
|
||||
|
||||
import (
|
||||
"context"
|
||||
"embed"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
|
||||
"github.com/onsonr/sonr/pkg/nebula/models"
|
||||
)
|
||||
|
||||
//go:embed assets
|
||||
var embeddedFiles embed.FS
|
||||
|
||||
//go:embed nebula.pkl
|
||||
var config []byte
|
||||
|
||||
func getHTTPFS() (http.FileSystem, error) {
|
||||
fsys, err := fs.Sub(embeddedFiles, "assets")
|
||||
if err != nil {
|
||||
@@ -27,10 +21,6 @@ func getHTTPFS() (http.FileSystem, error) {
|
||||
|
||||
// UseAssets is a middleware that serves static files from the embedded assets
|
||||
func UseAssets(e *echo.Echo) error {
|
||||
err := models.LoadFromString(context.Background(), string(config))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fsys, err := getHTTPFS()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -38,10 +28,5 @@ func UseAssets(e *echo.Echo) error {
|
||||
assets := http.FileServer(fsys)
|
||||
e.GET("/", echo.WrapHandler(assets))
|
||||
e.GET("/assets/*", echo.WrapHandler(http.StripPrefix("/assets/", assets)))
|
||||
e.GET("/_nebula/config", handleGetConfig)
|
||||
return nil
|
||||
}
|
||||
|
||||
func handleGetConfig(c echo.Context) error {
|
||||
return c.Blob(http.StatusOK, "application/octet-stream", config)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user