From 2f41b6d8b43b3967cd9f7682783b40257dc000d5 Mon Sep 17 00:00:00 2001 From: p4u1 Date: Mon, 8 Jul 2024 11:07:23 +0200 Subject: [PATCH] refactor(recipe): store sample env path in new struct --- pkg/recipe/recipe.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/recipe/recipe.go b/pkg/recipe/recipe.go index 6bc75f4a..c4ac38d4 100644 --- a/pkg/recipe/recipe.go +++ b/pkg/recipe/recipe.go @@ -239,10 +239,12 @@ func Get(recipeName string, offline bool) (Recipe, error) { } func Get2(name string) Recipe2 { + dir := path.Join(config.RECIPES_DIR, name) return Recipe2{ - Name: name, - Dir: path.Join(config.RECIPES_DIR, name), - SSHURL: fmt.Sprintf(config.SSH_URL_TEMPLATE, name), + Name: name, + Dir: dir, + SSHURL: fmt.Sprintf(config.SSH_URL_TEMPLATE, name), + SampleEnvPath: path.Join(dir, ".env.sample"), } } @@ -250,6 +252,8 @@ type Recipe2 struct { Name string Dir string SSHURL string + + SampleEnvPath string } // GetRecipesLocal retrieves all local recipe directories