add support for rulesets in JSON format for frontend use

This commit is contained in:
Kevin Pham
2023-12-05 21:03:27 -06:00
parent 52d12dd1ac
commit 0b33765b4f
5 changed files with 146 additions and 23 deletions

View File

@@ -1,6 +1,7 @@
package ruleset_v2
import (
"bytes"
"encoding/json"
"fmt"
@@ -134,5 +135,9 @@ func (rule *Rule) MarshalYAML() (interface{}, error) {
ResponseModifications: rule._rsms,
}
return yaml.Marshal(aux)
var b bytes.Buffer
y := yaml.NewEncoder(&b)
y.SetIndent(2)
err := y.Encode(aux)
return b.String(), err
}