Fix the problem with environment as secret

We needed to filter the environment coming from a env file, but declared
as secet in `secret-vars` label

fix #17
This commit is contained in:
2022-05-23 12:11:23 +02:00
parent 5fc8c06d8b
commit 114fab4870
2 changed files with 39 additions and 8 deletions

View File

@@ -573,6 +573,15 @@ func prepareEnvFromFiles(name string, s *types.ServiceConfig, container *helm.Co
secretsFiles = strings.Split(v, ",")
}
var secretVars []string
if v, ok := s.Labels[helm.LABEL_SECRETVARS]; ok {
secretVars = strings.Split(v, ",")
}
for i, s := range secretVars {
secretVars[i] = strings.TrimSpace(s)
}
// manage environment files (env_file in compose)
for _, envfile := range s.EnvFile {
f := PathToName(envfile)
@@ -594,7 +603,7 @@ func prepareEnvFromFiles(name string, s *types.ServiceConfig, container *helm.Co
}
envfile = filepath.Join(compose.GetCurrentDir(), envfile)
if err := store.AddEnvFile(envfile); err != nil {
if err := store.AddEnvFile(envfile, secretVars); err != nil {
logger.ActivateColors = true
logger.Red(err.Error())
logger.ActivateColors = false