installer-api: include config in app
diff --git a/core/installer/app_manager.go b/core/installer/app_manager.go
index f2e4369..fbf69d1 100644
--- a/core/installer/app_manager.go
+++ b/core/installer/app_manager.go
@@ -3,6 +3,7 @@
import (
"fmt"
"io/fs"
+ "io/ioutil"
"net"
"time"
@@ -50,6 +51,25 @@
return config, nil
}
+func (m *AppManager) AppConfig(name string) (map[string]any, error) {
+ wt, err := m.repo.Worktree()
+ if err != nil {
+ return nil, err
+ }
+ configF, err := wt.Filesystem.Open(wt.Filesystem.Join(appDirName, name, configFileName))
+ if err != nil {
+ return nil, err
+ }
+ defer configF.Close()
+ var cfg map[string]any
+ contents, err := ioutil.ReadAll(configF)
+ if err != nil {
+ return cfg, err
+ }
+ err = yaml.UnmarshalStrict(contents, &cfg)
+ return cfg, err
+}
+
func (m *AppManager) Install(app App, config map[string]any) error {
wt, err := m.repo.Worktree()
if err != nil {