mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-04 02:11:40 +00:00
feature/refactor ui (#1205)
* fix: correct HTTP error handling in gateway * refactor: migrate database and ORM to internal modules * feat: introduce taskfile build system for improved workflow management * refactor: update taskfiles to use relative paths * feat: add profile status field * refactor: move rendering logic to context package * fix: improve error handling in credentials retrieval * refactor: optimize HTTP request handling in Wasm environment * refactor: refactor config loading in motr command * chore: add process-compose for service management * chore: remove default task and update gum format command * fix: update project dependencies * refactor: improve code readability and maintainability * refactor: consolidate error handling components * refactor: update index handler to use new context package * refactor: consolidate database scripts and move to deploy directory * feat: Update flake.nix with development tools and environment configuration * fix: ignore flake.lock file * refactor: migrate build process to use taskfiles for improved modularity and maintainability * refactor: improve GatewayContext and reorganize handlers * refactor: Remove unused profile creation functions * (chore): templ generation * test: add test file for vaults.go * maintenance: remove defunct Discord server link * docs: update checks workflow documentation * test: remove obsolete vaults test file * refactor: move version bumping logic to release workflow
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
//go:build js && wasm
|
||||
|
||||
package vault
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
echomiddleware "github.com/labstack/echo/v4/middleware"
|
||||
"github.com/onsonr/sonr/app/vault/context"
|
||||
"github.com/onsonr/sonr/internal/config/motr"
|
||||
"github.com/onsonr/sonr/internal/database/motrorm"
|
||||
)
|
||||
|
||||
type Vault = *echo.Echo
|
||||
|
||||
// New returns a new Vault instance
|
||||
func New(config *motr.Config, dbq *motrorm.Queries) (Vault, error) {
|
||||
e := echo.New()
|
||||
// Override default behaviors
|
||||
e.IPExtractor = echo.ExtractIPDirect()
|
||||
e.HTTPErrorHandler = handleError()
|
||||
|
||||
// Built-in middleware
|
||||
e.Use(echomiddleware.Logger())
|
||||
e.Use(echomiddleware.Recover())
|
||||
e.Use(context.WASMMiddleware)
|
||||
registerRoutes(e)
|
||||
return e, nil
|
||||
}
|
||||
|
||||
func handleError() echo.HTTPErrorHandler {
|
||||
return func(err error, c echo.Context) {
|
||||
if he, ok := err.(*echo.HTTPError); ok {
|
||||
// Log the error if needed
|
||||
c.Logger().Errorf("Error: %v", he.Message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// RegisterRoutes registers the Decentralized Web Node API routes.
|
||||
func registerRoutes(e *echo.Echo) {
|
||||
}
|
||||
Reference in New Issue
Block a user