Add dev flag to indicate development runs

Used to reload the templates on each page view.
This commit is contained in:
Las Zenow 2020-12-03 12:58:37 +00:00
parent 1536d97d8d
commit fe36b1d23c
2 changed files with 46 additions and 3 deletions

View file

@ -25,6 +25,7 @@ func main() {
setAdminUser = flag.String("set-admin-user", "", "create/update this user to be admin if set-admin-pass is also specified")
setAdminPass = flag.String("set-admin-pass", "", "create/update admin user password if set-admin-user is also specified")
ro = flag.Bool("ro", false, "read only mode")
dev = flag.Bool("dev", false, "development mode (reload templates on each page view)")
)
flag.Parse()
@ -63,7 +64,12 @@ func main() {
db = database.RO(db)
}
template := trantor.InitTemplate(*assetsPath)
var template *trantor.Template
if *dev {
template = trantor.InitDevTemplate(*assetsPath)
} else {
template = trantor.InitTemplate(*assetsPath)
}
sg := trantor.InitStats(db, store, template, *ro)
trantor.InitUpload(db, store)
trantor.InitTasks(db, *loggerConfig)