implemented config
This commit is contained in:
parent
0de632d29c
commit
1892da9682
12
main.go
12
main.go
@ -11,6 +11,15 @@ import (
|
|||||||
|
|
||||||
var CurrentRenderingConfig = rendering.DefaultRenderingConfig()
|
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 {
|
func getIndex(c echo.Context) error {
|
||||||
var tpl bytes.Buffer
|
var tpl bytes.Buffer
|
||||||
rendering.IndexTemplate.Execute(&tpl, CurrentRenderingConfig)
|
rendering.IndexTemplate.Execute(&tpl, CurrentRenderingConfig)
|
||||||
@ -25,5 +34,8 @@ func main() {
|
|||||||
e.Static("/assets", "frontend/assets")
|
e.Static("/assets", "frontend/assets")
|
||||||
e.GET("/", getIndex)
|
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"))
|
e.Logger.Fatal(e.Start(":5500"))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user