db.get err
This commit is contained in:
parent
c3e149bc4e
commit
9df029453b
1 changed files with 14 additions and 2 deletions
16
main.go
16
main.go
|
@ -236,6 +236,18 @@ func renderIndex(w gemini.ResponseWriter, client TreeManagerClient) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastRebuild, found := db.Get("last_rebuild")
|
||||||
|
if !found {
|
||||||
|
w.WriteHeader(gemini.StatusTemporaryFailure, "Internal server error")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
pageCounter, found := db.Get("page_counter")
|
||||||
|
if !found {
|
||||||
|
w.WriteHeader(gemini.StatusTemporaryFailure, "Internal server error")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
w.SetMediaType("text/gemini")
|
w.SetMediaType("text/gemini")
|
||||||
tpl := pongo2.Must(pongo2.FromFile(fmt.Sprintf("templates/%s/index.gmi", defaultLang)))
|
tpl := pongo2.Must(pongo2.FromFile(fmt.Sprintf("templates/%s/index.gmi", defaultLang)))
|
||||||
page, err := tpl.Execute(
|
page, err := tpl.Execute(
|
||||||
|
@ -243,8 +255,8 @@ func renderIndex(w gemini.ResponseWriter, client TreeManagerClient) {
|
||||||
"tree": tree,
|
"tree": tree,
|
||||||
"lang": defaultLang,
|
"lang": defaultLang,
|
||||||
"lastFiles": GetLastFiles(tree.Files),
|
"lastFiles": GetLastFiles(tree.Files),
|
||||||
"lastRebuild": db.Get("last_rebuild"),
|
"lastRebuild": lastRebuild,
|
||||||
"pageCounter": db.Get("page_counter"),
|
"pageCounter": pageCounter,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue