mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
refactor: move session management to dedicated database module
This commit is contained in:
+6
-1
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/echo/v4/middleware"
|
||||
"github.com/onsonr/sonr/crypto/ucan"
|
||||
"github.com/onsonr/sonr/internal/database/sessions"
|
||||
"github.com/onsonr/sonr/internal/gateway"
|
||||
"github.com/onsonr/sonr/internal/gateway/config"
|
||||
"github.com/onsonr/sonr/pkg/common/ipfs"
|
||||
@@ -29,12 +30,16 @@ func setupServer(env config.Env) (*echo.Echo, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
db, err := sessions.InitDB(env)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
e := echo.New()
|
||||
e.IPExtractor = echo.ExtractIPDirect()
|
||||
e.Use(middleware.Logger())
|
||||
e.Use(middleware.Recover())
|
||||
e.Use(producer.Middleware(ipc, ucan.ServicePermissions))
|
||||
gateway.RegisterRoutes(e, env)
|
||||
gateway.RegisterRoutes(e, env, db)
|
||||
return e, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user