forked from toolshed/abra
fix: fix: trim comments that are not modifers
See coop-cloud/organising#505
This commit is contained in:
@ -69,9 +69,14 @@ func GeneratePassphrases(count uint) ([]string, error) {
|
||||
// and some times you don't (as the caller). We need to be able to handle the
|
||||
// "app new" case where we pass in the .env.sample and the "secret generate"
|
||||
// case where the app is created.
|
||||
func ReadSecretsConfig(appEnv map[string]string, composeFiles []string, recipeName string) (map[string]string, error) {
|
||||
func ReadSecretsConfig(appEnvPath string, composeFiles []string, recipeName string) (map[string]string, error) {
|
||||
secretConfigs := make(map[string]string)
|
||||
|
||||
appEnv, err := config.ReadEnv(appEnvPath, config.ReadEnvOptions{IncludeModifiers: true})
|
||||
if err != nil {
|
||||
return secretConfigs, err
|
||||
}
|
||||
|
||||
opts := stack.Deploy{Composefiles: composeFiles}
|
||||
config, err := loader.LoadComposefile(opts, appEnv)
|
||||
if err != nil {
|
||||
@ -232,7 +237,7 @@ func PollSecretsStatus(cl *dockerClient.Client, app config.App) (secretStatuses,
|
||||
return secStats, err
|
||||
}
|
||||
|
||||
secretsConfig, err := ReadSecretsConfig(app.Env, composeFiles, app.Recipe)
|
||||
secretsConfig, err := ReadSecretsConfig(app.Path, composeFiles, app.Recipe)
|
||||
if err != nil {
|
||||
return secStats, err
|
||||
}
|
||||
|
@ -18,13 +18,14 @@ func TestReadSecretsConfig(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
sampleEnv, err := recipe.SampleEnv()
|
||||
sampleEnv, err := recipe.SampleEnv(config.ReadEnvOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
composeFiles := []string{path.Join(config.RECIPES_DIR, recipe.Name, "compose.yml")}
|
||||
secretsFromConfig, err := ReadSecretsConfig(sampleEnv, composeFiles, recipe.Name)
|
||||
envSamplePath := path.Join(config.RECIPES_DIR, recipe.Name, ".env.sample")
|
||||
secretsFromConfig, err := ReadSecretsConfig(envSamplePath, composeFiles, recipe.Name)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user