@@ 20,6 20,7 @@ import (
"github.com/labstack/echo/v4/middleware"
"hg.code.netlandish.com/~netlandish/gobwebs"
"hg.code.netlandish.com/~netlandish/gobwebs/config"
+ "hg.code.netlandish.com/~netlandish/gobwebs/database"
"hg.code.netlandish.com/~netlandish/gobwebs/email"
"hg.code.netlandish.com/~netlandish/gobwebs/internal/localizer"
"hg.code.netlandish.com/~netlandish/gobwebs/storage"
@@ 66,6 67,7 @@ type Server struct {
type Context struct {
echo.Context
Server *Server
+ DB database.DBI
User gobwebs.User
}
@@ 289,7 291,7 @@ func (s *Server) WithDefaultMiddleware() *Server {
// Set custom context
s.e.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
- ctx := &Context{Context: c, Server: s}
+ ctx := &Context{Context: c, Server: s, DB: database.NewDB(s.DB)}
return next(ctx)
}
})