Compare commits

3 Commits

Author SHA1 Message Date
a38c883450 Update to Go-1.25.3
All checks were successful
release-tag / release-image (push) Successful in 2m56s
2025-10-21 07:22:05 +02:00
2f01625cff Try to fix loading issue on some templates.
All checks were successful
release-tag / release-image (push) Successful in 2m39s
2025-05-18 22:29:10 +02:00
a78eab43d9 added store handler
All checks were successful
release-tag / release-image (push) Successful in 2m25s
2025-05-18 22:05:44 +02:00
3 changed files with 21 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
############################
# 1) GoBuild
############################
FROM golang:1.23.1 AS build
FROM golang:1.25 AS build
WORKDIR /app
COPY go.mod go.sum ./

View File

@@ -117,6 +117,7 @@ func main() {
staticDir := getenv("BLOG_STATIC_DIR", "/app/internal/web/static")
pagesDir := getenv("BLOG_PAGES_DIR", "/pages")
templatesDir := getenv("BLOG_TEMPLATES_DIR", "/templates")
storeEnabled := enabled("STORE_ENABLE", false)
ticksDir := getenv("BLOG_TICKS_DIR", "/ticks")
gitEnable := enabled("GIT_ENABLE", false)
gitRepo := getenv("GIT_REPO", "null")
@@ -131,6 +132,8 @@ func main() {
fmt.Println("Geladener Katalog:", TickCatalog)
cloneRepo(gitRepo, gitBranch, gitDir)
funcs := template.FuncMap{
"now": time.Now, // jetztZeit bereitstellen
}
@@ -138,6 +141,11 @@ func main() {
// Basislayout zuerst parsen
layout := template.Must(template.New("base").Funcs(funcs).ParseFiles(templatesDir + "/base.html"))
var tplStore *template.Template
if storeEnabled {
tplStore = template.Must(template.New("store").Funcs(funcs).ParseFiles(templatesDir + "/store.html"))
}
// LISTSeite: base + list.html
tplList = template.Must(layout.Clone())
template.Must(tplList.Funcs(funcs).ParseFiles(templatesDir + "/list.html"))
@@ -220,6 +228,17 @@ func main() {
mux.Handle("/static/", cacheControl(http.StripPrefix("/static/", http.FileServer(http.Dir(staticDir)))))
mux.HandleFunc("/store", func(w http.ResponseWriter, r *http.Request) {
if storeEnabled {
if err := tplStore.ExecuteTemplate(w, "store", nil); err != nil {
http.Error(w, err.Error(), 500)
}
} else {
http.NotFound(w, r)
}
})
if gitEnable {
xMinute, _ := strconv.Atoi(gitInterval)
xDuration := time.Duration(xMinute) * time.Minute

2
go.mod
View File

@@ -1,5 +1,5 @@
module git.send.nrw/sendnrw/b1tsblog
go 1.23.1
go 1.25.3
require github.com/gomarkdown/markdown v0.0.0-20250311123330-531bef5e742b