mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 04:48:26 +08:00
feat(mgmt): added mgmt extension which returns current zot configuration (#1198)
Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user