go(app): use embedded variable value
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
leo 2023-04-26 23:11:58 +02:00
parent 8c7c84f6f9
commit d99d86a2be
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ
2 changed files with 8 additions and 5 deletions

@ -6,7 +6,9 @@ import (
"os" "os"
) )
func (a *App) getAssets(live bool) http.FileSystem { func (a *App) getAssets() http.FileSystem {
live := a.config.LiveMode
if live { if live {
a.logger.Info("assets loaded in live mode") a.logger.Info("assets loaded in live mode")
@ -23,7 +25,9 @@ func (a *App) getAssets(live bool) http.FileSystem {
return http.FS(fsys) return http.FS(fsys)
} }
func (a *App) getTemplates(live bool) fs.FS { func (a *App) getTemplates() fs.FS {
live := a.config.LiveMode
if live { if live {
a.logger.Info("templates loaded in live mode") a.logger.Info("templates loaded in live mode")

@ -11,9 +11,8 @@ import (
func (a *App) SetupRoutes() { func (a *App) SetupRoutes() {
e := a.E() e := a.E()
conf := a.Config() conf := a.Config()
liveMode := conf.LiveMode assets := http.FileServer(a.getAssets())
assets := http.FileServer(a.getAssets(liveMode)) tmpls := a.getTemplates()
tmpls := a.getTemplates(liveMode)
// run this before declaring any handler funcs. // run this before declaring any handler funcs.
handlers.InitHandlers(a.version, conf, tmpls) handlers.InitHandlers(a.version, conf, tmpls)