mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 00:55:32 +00:00
XML parsing overhaul
This commit is contained in:
@@ -45,22 +45,23 @@ type Server struct {
|
||||
running chan bool
|
||||
shutdown *sync.WaitGroup
|
||||
cache *memory.Storage
|
||||
|
||||
mu sync.Mutex
|
||||
watcher *helpers.FileWatcher
|
||||
engine *templating.Engine
|
||||
mu sync.Mutex
|
||||
watcher *helpers.FileWatcher
|
||||
|
||||
kgpz *app.KGPZ
|
||||
}
|
||||
|
||||
func Create(k *app.KGPZ, c *providers.ConfigProvider) *Server {
|
||||
func Create(k *app.KGPZ, c *providers.ConfigProvider, e *templating.Engine) *Server {
|
||||
if c == nil || k == nil {
|
||||
logging.Error(nil, "Config or KGPZ is posssibly nil while tying to create server")
|
||||
logging.Error(nil, "Error creating server: Config or App is posssibly nil.")
|
||||
return nil
|
||||
}
|
||||
|
||||
return &Server{
|
||||
Config: c,
|
||||
kgpz: k,
|
||||
engine: e,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,12 +97,12 @@ func (s *Server) Watcher() error {
|
||||
}
|
||||
|
||||
func (s *Server) Start() {
|
||||
s.engine.Reload()
|
||||
|
||||
s.cache = memory.New(memory.Config{
|
||||
GCInterval: 30 * time.Second,
|
||||
})
|
||||
|
||||
engine := templating.NewEngine(&views.LayoutFS, &views.RoutesFS)
|
||||
|
||||
srv := fiber.New(fiber.Config{
|
||||
AppName: s.Config.Address,
|
||||
CaseSensitive: false,
|
||||
@@ -118,7 +119,7 @@ func (s *Server) Start() {
|
||||
|
||||
PassLocalsToViews: true,
|
||||
|
||||
Views: engine,
|
||||
Views: s.engine,
|
||||
ViewsLayout: templating.DEFAULT_LAYOUT_NAME,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user