refactor: use central logger

This commit is contained in:
2024-07-07 23:45:37 +02:00
parent cf8ff410cc
commit ef108d63e1
86 changed files with 903 additions and 889 deletions

View File

@ -11,7 +11,7 @@ import (
"coopcloud.tech/abra/cli/internal"
"coopcloud.tech/abra/pkg/config"
"coopcloud.tech/abra/pkg/git"
"github.com/sirupsen/logrus"
"coopcloud.tech/abra/pkg/log"
"github.com/urfave/cli"
)
@ -62,19 +62,19 @@ recipe and domain in the sample environment config).
directory := path.Join(config.RECIPES_DIR, recipeName)
if _, err := os.Stat(directory); !os.IsNotExist(err) {
logrus.Fatalf("%s recipe directory already exists?", directory)
log.Fatalf("%s recipe directory already exists?", directory)
}
url := fmt.Sprintf("%s/example.git", config.REPOS_BASE_URL)
if err := git.Clone(directory, url); err != nil {
logrus.Fatal(err)
log.Fatal(err)
}
gitRepo := path.Join(config.RECIPES_DIR, recipeName, ".git")
if err := os.RemoveAll(gitRepo); err != nil {
logrus.Fatal(err)
log.Fatal(err)
}
logrus.Debugf("removed example git repo in %s", gitRepo)
log.Debugf("removed example git repo in %s", gitRepo)
meta := newRecipeMeta(recipeName)
@ -85,23 +85,23 @@ recipe and domain in the sample environment config).
for _, path := range toParse {
tpl, err := template.ParseFiles(path)
if err != nil {
logrus.Fatal(err)
log.Fatal(err)
}
var templated bytes.Buffer
if err := tpl.Execute(&templated, meta); err != nil {
logrus.Fatal(err)
log.Fatal(err)
}
if err := os.WriteFile(path, templated.Bytes(), 0644); err != nil {
logrus.Fatal(err)
log.Fatal(err)
}
}
newGitRepo := path.Join(config.RECIPES_DIR, recipeName)
if err := git.Init(newGitRepo, true, internal.GitName, internal.GitEmail); err != nil {
logrus.Fatal(err)
log.Fatal(err)
}
fmt.Print(fmt.Sprintf(`