installer: repoio readyaml
diff --git a/core/installer/repoio.go b/core/installer/repoio.go
index 0582594..ec7981c 100644
--- a/core/installer/repoio.go
+++ b/core/installer/repoio.go
@@ -25,6 +25,7 @@
ReadAppConfig(path string) (AppConfig, error)
ReadKustomization(path string) (*Kustomization, error)
WriteKustomization(path string, kust Kustomization) error
+ ReadYaml(path string) (any, error)
WriteYaml(path string, data any) error
CommitAndPush(message string) error
Reader(path string) (io.ReadCloser, error)
@@ -140,6 +141,18 @@
return nil
}
+func (r *repoIO) ReadYaml(path string) (any, error) {
+ inp, err := r.Reader(path)
+ if err != nil {
+ return nil, err
+ }
+ data := make(map[string]any)
+ if err := readYaml(inp, &data); err != nil {
+ return nil, err
+ }
+ return data, err
+}
+
func (r *repoIO) CommitAndPush(message string) error {
wt, err := r.repo.Worktree()
if err != nil {