aboutsummaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'server.go')
-rw-r--r--server.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/server.go b/server.go
index 266e582..b20b314 100644
--- a/server.go
+++ b/server.go
@@ -14,6 +14,7 @@ const cookieName = "koushin_session"
// Server holds all the koushin server state.
type Server struct {
+ renderer *renderer
Sessions *SessionManager
Plugins []Plugin
@@ -72,6 +73,10 @@ func (s *Server) parseSMTPURL(smtpURL string) error {
return nil
}
+func (s *Server) Reload() error {
+ return s.renderer.reload(s.Plugins)
+}
+
func newServer(imapURL, smtpURL string) (*Server, error) {
s := &Server{}
@@ -150,8 +155,9 @@ func New(e *echo.Echo, options *Options) (*Server, error) {
}
s.Plugins = append(s.Plugins, luaPlugins...)
- e.Renderer, err = loadTemplates(e.Logger, options.Theme, s.Plugins)
- if err != nil {
+ s.renderer = newRenderer(e.Logger, options.Theme)
+ e.Renderer = s.renderer
+ if err := s.renderer.reload(s.Plugins); err != nil {
return nil, fmt.Errorf("failed to load templates: %v", err)
}