fix: clone catalogue on initial run

This commit is contained in:
decentral1se 2023-09-05 11:13:19 +02:00 committed by decentral1se
parent 64cfdae6b7
commit b4fd7fd77c
1 changed files with 9 additions and 0 deletions

View File

@ -16,6 +16,7 @@ import (
"coopcloud.tech/abra/cli/server"
"coopcloud.tech/abra/pkg/autocomplete"
"coopcloud.tech/abra/pkg/config"
"coopcloud.tech/abra/pkg/git"
"coopcloud.tech/abra/pkg/web"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
@ -185,6 +186,14 @@ func newAbraApp(version, commit string) *cli.App {
}
}
if _, err := os.Stat(config.CATALOGUE_DIR); os.IsNotExist(err) {
url := fmt.Sprintf("%s/%s.git", config.REPOS_BASE_URL, config.CATALOGUE_JSON_REPO_NAME)
logrus.Warnf("local recipe catalogue is missing, retrieving now")
if err := git.Clone(config.CATALOGUE_DIR, url); err != nil {
logrus.Fatal(err)
}
}
logrus.Debugf("abra version %s, commit %s", version, commit)
return nil