Skip to content

Commit

Permalink
api: add json format response (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhebox authored Oct 19, 2023
1 parent 35f3c79 commit 3354c7a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/server/api/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ func (h *HTTPServer) ConfigSet(c *gin.Context) {
}

func (h *HTTPServer) ConfigGet(c *gin.Context) {
c.TOML(http.StatusOK, h.mgr.cfg.GetConfig())
switch c.Query("format") {
case "json":
c.JSON(http.StatusOK, h.mgr.cfg.GetConfig())
default:
c.TOML(http.StatusOK, h.mgr.cfg.GetConfig())
}
}

func (h *HTTPServer) registerConfig(group *gin.RouterGroup) {
Expand Down

0 comments on commit 3354c7a

Please sign in to comment.