aboutsummaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'server.go')
-rw-r--r--server.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/server.go b/server.go
index d8aeca7..0845628 100644
--- a/server.go
+++ b/server.go
@@ -28,6 +28,8 @@ type Server struct {
tls bool
insecure bool
}
+
+ plugins []Plugin
}
func (s *Server) parseIMAPURL(imapURL string) error {
@@ -131,6 +133,11 @@ func New(e *echo.Echo, options *Options) error {
return fmt.Errorf("failed to load templates: %v", err)
}
+ s.plugins, err = loadAllLuaPlugins(e.Logger)
+ if err != nil {
+ return fmt.Errorf("failed to load plugins: %v", err)
+ }
+
e.HTTPErrorHandler = func(err error, c echo.Context) {
code := http.StatusInternalServerError
if he, ok := err.(*echo.HTTPError); ok {
@@ -145,6 +152,7 @@ func New(e *echo.Echo, options *Options) error {
e.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
return func(ectx echo.Context) error {
ctx := &context{Context: ectx, server: s}
+ ctx.Set("context", ctx)
cookie, err := ctx.Cookie(cookieName)
if err == http.ErrNoCookie {