diff --git a/cli/app/new.go b/cli/app/new.go index 63aff1de6..d0de12b3c 100644 --- a/cli/app/new.go +++ b/cli/app/new.go @@ -132,7 +132,7 @@ var appNewCommand = cli.Command{ var secrets AppSecrets var secretTable *jsontable.JSONTable if internal.Secrets { - sampleEnv, err := recipe.SampleEnv() + sampleEnv, err := r.SampleEnv() if err != nil { log.Fatal(err) } diff --git a/pkg/recipe/files.go b/pkg/recipe/files.go new file mode 100644 index 000000000..6177458f4 --- /dev/null +++ b/pkg/recipe/files.go @@ -0,0 +1,18 @@ +package recipe + +import ( + "fmt" + "path" + + "coopcloud.tech/abra/pkg/config" + "coopcloud.tech/abra/pkg/envfile" +) + +func (r Recipe2) SampleEnv() (map[string]string, error) { + envSamplePath := path.Join(config.RECIPES_DIR, r.Name, ".env.sample") + sampleEnv, err := envfile.ReadEnv(envSamplePath) + if err != nil { + return sampleEnv, fmt.Errorf("unable to discover .env.sample for %s", r.Name) + } + return sampleEnv, nil +} diff --git a/pkg/recipe/recipe.go b/pkg/recipe/recipe.go index 0d0d2ba4a..6bc75f4ab 100644 --- a/pkg/recipe/recipe.go +++ b/pkg/recipe/recipe.go @@ -238,15 +238,6 @@ func Get(recipeName string, offline bool) (Recipe, error) { }, nil } -func (r Recipe) SampleEnv() (map[string]string, error) { - envSamplePath := path.Join(config.RECIPES_DIR, r.Name, ".env.sample") - sampleEnv, err := envfile.ReadEnv(envSamplePath) - if err != nil { - return sampleEnv, fmt.Errorf("unable to discover .env.sample for %s", r.Name) - } - return sampleEnv, nil -} - func Get2(name string) Recipe2 { return Recipe2{ Name: name,