feat: support switch hashicorp plugin with environment HRP_PLUGIN_TYPE

This commit is contained in:
debugtalk
2022-03-04 20:34:24 +08:00
parent c27224a452
commit ea89a0b6a9
8 changed files with 73 additions and 21 deletions

View File

@@ -96,7 +96,7 @@ func Dump2JSON(data interface{}, path string) error {
return err
}
log.Info().Str("path", path).Msg("dump data to json")
file, _ := json.MarshalIndent(data, "", "\t")
file, _ := json.MarshalIndent(data, "", " ")
err = os.WriteFile(path, file, 0644)
if err != nil {
log.Error().Err(err).Msg("dump json path failed")
@@ -137,7 +137,7 @@ func FormatResponse(raw interface{}) interface{} {
for key, value := range raw.(map[string]interface{}) {
// convert value to json
if key == "body" {
b, _ := json.MarshalIndent(&value, "", "\t")
b, _ := json.MarshalIndent(&value, "", " ")
value = string(b)
}
formattedResponse[key] = value