Skip to content

Commit 3354c7a

Browse files
authored
api: add json format response (#385)
1 parent 35f3c79 commit 3354c7a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/server/api/config.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ func (h *HTTPServer) ConfigSet(c *gin.Context) {
3535
}
3636

3737
func (h *HTTPServer) ConfigGet(c *gin.Context) {
38-
c.TOML(http.StatusOK, h.mgr.cfg.GetConfig())
38+
switch c.Query("format") {
39+
case "json":
40+
c.JSON(http.StatusOK, h.mgr.cfg.GetConfig())
41+
default:
42+
c.TOML(http.StatusOK, h.mgr.cfg.GetConfig())
43+
}
3944
}
4045

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

0 commit comments

Comments
 (0)