installer: appmanager cmd
diff --git a/core/installer/app.go b/core/installer/app.go
index 2f702d8..6f766b9 100644
--- a/core/installer/app.go
+++ b/core/installer/app.go
@@ -2,17 +2,41 @@
import (
"embed"
+ "fmt"
"log"
"text/template"
)
+//go:embed values-tmpl
+var valuesTmpls embed.FS
+
type App struct {
Name string
Templates []*template.Template
}
-//go:embed values-tmpl
-var valuesTmpls embed.FS
+type AppRepository interface {
+ Find(name string) (*App, error)
+}
+
+type InMemoryAppRepository struct {
+ apps []App
+}
+
+func NewInMemoryAppRepository(apps []App) AppRepository {
+ return &InMemoryAppRepository{
+ apps,
+ }
+}
+
+func (r InMemoryAppRepository) Find(name string) (*App, error) {
+ for _, a := range r.apps {
+ if a.Name == name {
+ return &a, nil
+ }
+ }
+ return nil, fmt.Errorf("Application not found: %s", name)
+}
func CreateAllApps() []App {
tmpls, err := template.ParseFS(valuesTmpls, "values-tmpl/*.yaml")