forked from toolshed/abra
refactor(recipe): use method or variable for .env.sample
This commit is contained in:
@ -13,9 +13,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"coopcloud.tech/abra/pkg/catalogue"
|
||||
"coopcloud.tech/abra/pkg/compose"
|
||||
"coopcloud.tech/abra/pkg/config"
|
||||
"coopcloud.tech/abra/pkg/envfile"
|
||||
"coopcloud.tech/abra/pkg/formatter"
|
||||
gitPkg "coopcloud.tech/abra/pkg/git"
|
||||
"coopcloud.tech/abra/pkg/limit"
|
||||
@ -143,29 +141,6 @@ func (r Recipe) Dir() string {
|
||||
return path.Join(config.RECIPES_DIR, r.Name)
|
||||
}
|
||||
|
||||
// UpdateLabel updates a recipe label
|
||||
func (r Recipe) UpdateLabel(pattern, serviceName, label string) error {
|
||||
fullPattern := fmt.Sprintf("%s/%s/%s", config.RECIPES_DIR, r.Name, pattern)
|
||||
if err := compose.UpdateLabel(fullPattern, serviceName, label, r.Name); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateTag updates a recipe tag
|
||||
func (r Recipe) UpdateTag(image, tag string) (bool, error) {
|
||||
pattern := fmt.Sprintf("%s/%s/compose**yml", config.RECIPES_DIR, r.Name)
|
||||
|
||||
image = formatter.StripTagMeta(image)
|
||||
|
||||
ok, err := compose.UpdateTag(pattern, image, tag, r.Name)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return ok, nil
|
||||
}
|
||||
|
||||
// Tags list the recipe tags
|
||||
func (r Recipe) Tags() ([]string, error) {
|
||||
var tags []string
|
||||
@ -209,8 +184,7 @@ func Get(recipeName string, offline bool) (Recipe, error) {
|
||||
return Recipe{}, fmt.Errorf("%s is missing a compose.yml or compose.*.yml file?", r.Name)
|
||||
}
|
||||
|
||||
envSamplePath := path.Join(config.RECIPES_DIR, r.Name, ".env.sample")
|
||||
sampleEnv, err := envfile.ReadEnv(envSamplePath)
|
||||
sampleEnv, err := r.SampleEnv()
|
||||
if err != nil {
|
||||
return Recipe{}, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user