add override functionallity

This commit is contained in:
Fran Jurmanović
2025-02-05 19:48:55 +01:00
parent 2c6f4494f4
commit 6fbc718a47
5 changed files with 82 additions and 49 deletions

View File

@@ -1,6 +1,8 @@
package common
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net"
@@ -69,3 +71,13 @@ func RunElevatedCommand(command string, service string) (string, error) {
}
return string(output), nil
}
func IndentJson(body []byte) ([]byte, error) {
newBody := new([]byte)
unmarshaledBody := bytes.NewBuffer(*newBody)
err := json.Indent(unmarshaledBody, body, "", " ")
if err != nil {
return nil, err
}
return unmarshaledBody.Bytes(), nil
}