feat(mgmt): added mgmt extension which returns current zot configuration (#1198)

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
peusebiu
2023-03-09 20:43:26 +02:00
committed by GitHub
parent 4c156234cb
commit f04e66a5e2
21 changed files with 807 additions and 33 deletions
+20
View File
@@ -211,3 +211,23 @@ func DirExists(d string) bool {
return true
}
// Used to filter a json fields by using an intermediate struct.
func MarshalThroughStruct(obj interface{}, throughStruct interface{}) ([]byte, error) {
toJSON, err := json.Marshal(obj)
if err != nil {
return []byte{}, err
}
err = json.Unmarshal(toJSON, throughStruct)
if err != nil {
return []byte{}, err
}
toJSON, err = json.Marshal(throughStruct)
if err != nil {
return []byte{}, err
}
return toJSON, nil
}