diff --git a/api/config.go b/api/config.go index 2cce93e..affa7b3 100644 --- a/api/config.go +++ b/api/config.go @@ -62,6 +62,9 @@ type saveConfigRequest struct { // output format, one of yaml|json, default is yaml. // in: query Format string `form:"format" json:"format"` + // file path, default is gost.yaml|gost.json in current working directory. + // in: query + Path string `form:"path" json:"path"` } // successful operation. @@ -92,6 +95,10 @@ func saveConfig(ctx *gin.Context) { req.Format = "yaml" } + if req.Path != "" { + file = req.Path + } + f, err := os.Create(file) if err != nil { writeError(ctx, &Error{