forked from toolshed/abra
refactor(recipe): move SampleEnv method to new struct
This commit is contained in:
18
pkg/recipe/files.go
Normal file
18
pkg/recipe/files.go
Normal file
@ -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
|
||||
}
|
Reference in New Issue
Block a user