refactor: construct recipe struct proper

This commit is contained in:
2021-09-06 01:41:16 +02:00
parent 6a1ecd0f85
commit 356c8f8c4e
6 changed files with 26 additions and 33 deletions

View File

@ -5,7 +5,6 @@ import (
"coopcloud.tech/abra/cli/internal"
"coopcloud.tech/abra/pkg/client"
"coopcloud.tech/abra/pkg/recipe"
"github.com/docker/distribution/reference"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
@ -27,12 +26,7 @@ the versioning metadata of up-and-running containers are.
`,
ArgsUsage: "<recipe>",
Action: func(c *cli.Context) error {
recipeName := internal.ValidateRecipe(c)
recipe, err := recipe.Get(recipeName)
if err != nil {
logrus.Fatal(err)
}
recipe := internal.ValidateRecipe(c)
hasAppService := false
for _, service := range recipe.Config.Services {
@ -42,7 +36,7 @@ the versioning metadata of up-and-running containers are.
}
if !hasAppService {
logrus.Fatal(fmt.Sprintf("No 'app' service defined in '%s', cannot proceed", recipeName))
logrus.Fatal(fmt.Sprintf("No 'app' service defined in '%s', cannot proceed", recipe.Name))
}
for _, service := range recipe.Config.Services {