Load tempaltes on startup

This commit is contained in:
Melon 2023-10-08 16:44:41 +01:00
parent 3ef2923e52
commit f5f003298e
Signed by: melon
GPG Key ID: 6C9D970C50D26A25

View File

@ -6,6 +6,7 @@ import (
"encoding/json"
"flag"
"github.com/1f349/lavender/server"
"github.com/1f349/lavender/server/pages"
"github.com/1f349/violet/utils"
exit_reload "github.com/MrMelon54/exit-reload"
"github.com/MrMelon54/mjwt"
@ -71,6 +72,11 @@ func normalLoad(startUp server.Conf, wd string) {
log.Fatal("[Lavender] Failed to load or create MJWT signer:", err)
}
err = pages.LoadPages(wd)
if err != nil {
log.Fatal("[Lavender] Failed to load page templates:", err)
}
srv := server.NewHttpServer(startUp, mSign)
log.Printf("[Lavender] Starting HTTP server on '%s'\n", srv.Addr)
go utils.RunBackgroundHttp("HTTP", srv)