Separate DEV_MODE (for assets + templates) and DEBUG (for logs + special routes)

This commit is contained in:
William Bouzourène 2025-01-24 13:54:31 +01:00
parent 13a5bc65b6
commit f7e06a3c12
Signed by: bouzoure
SSH key fingerprint: SHA256:19MbXpLua4rUtk8tunMesD8KUKb91LXLHg8E/qTooww
3 changed files with 7 additions and 4 deletions

View file

@ -50,7 +50,7 @@ func main() {
// Create a new engine
var engine *django.Engine
if config.Debug {
if config.DevMode {
engine = django.New("./views", ".html")
engine.ShouldReload = true
} else {
@ -72,7 +72,7 @@ func main() {
ErrorHandler: helpers.FiberErrorHandler,
})
if config.Debug {
if config.DevMode {
app.Static("/static", "./static")
} else {
app.Use("/static", filesystem.New(filesystem.Config{
@ -101,6 +101,7 @@ func main() {
app.Use(middlewares.MfaVerifyMiddleware)
app.Use(middlewares.TemplatesMiddleware)
app.Use("/admin", middlewares.AuthzAdmin)
app.Use("/debug", middlewares.AuthzAdmin)
// Main pages
app.Get("/", controllers.Homepage)