implemented config

This commit is contained in:
Hazel Noack 2025-07-03 15:06:57 +02:00
parent 0de632d29c
commit 1892da9682

12
main.go
View File

@ -11,6 +11,15 @@ import (
var CurrentRenderingConfig = rendering.DefaultRenderingConfig()
func setConfig(c echo.Context) error {
err := c.Bind(&CurrentRenderingConfig)
if err != nil {
return c.String(http.StatusBadRequest, err.Error())
}
return c.String(http.StatusOK, "OK")
}
func getIndex(c echo.Context) error {
var tpl bytes.Buffer
rendering.IndexTemplate.Execute(&tpl, CurrentRenderingConfig)
@ -25,5 +34,8 @@ func main() {
e.Static("/assets", "frontend/assets")
e.GET("/", getIndex)
// this is for me to later setup the ctl such that I can config the running program on the command line
e.POST("/api/config", setConfig)
e.Logger.Fatal(e.Start(":5500"))
}