Better config (#50)

This commit is contained in:
Thomas Miceli
2023-06-07 20:50:30 +02:00
committed by GitHub
parent c517c2d9c9
commit 24e3de8fc1
9 changed files with 294 additions and 137 deletions

View File

@ -185,15 +185,16 @@ func adminSyncReposFromDB(ctx echo.Context) error {
return redirect(ctx, "/admin-panel")
}
func adminSettings(ctx echo.Context) error {
setData(ctx, "title", "Admin Settings")
setData(ctx, "htmlTitle", "Admin Settings - Admin panel")
setData(ctx, "adminHeaderPage", "settings")
func adminConfig(ctx echo.Context) error {
setData(ctx, "title", "Configuration")
setData(ctx, "htmlTitle", "Configuration - Admin panel")
setData(ctx, "adminHeaderPage", "config")
setData(ctx, "c", config.C)
return html(ctx, "admin_settings.html")
return html(ctx, "admin_config.html")
}
func adminSetSetting(ctx echo.Context) error {
func adminSetConfig(ctx echo.Context) error {
key := ctx.FormValue("key")
value := ctx.FormValue("value")

View File

@ -193,8 +193,8 @@ func Start() {
g2.POST("/gists/:gist/delete", adminGistDelete)
g2.POST("/sync-fs", adminSyncReposFromFS)
g2.POST("/sync-db", adminSyncReposFromDB)
g2.GET("/settings", adminSettings)
g2.PUT("/set-setting", adminSetSetting)
g2.GET("/configuration", adminConfig)
g2.PUT("/set-config", adminSetConfig)
}
g1.GET("/all", allGists, checkRequireLogin)