From 1a1d2b5ee8ad38d8865252c23c2649fd2c53c1e6 Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Fri, 22 Nov 2024 14:55:42 +0100 Subject: [PATCH] fix(configmap): do not write env var in file CM File CM are configmap to store "static" data (file content), do not set environment variables inside. --- generator/configMap.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/generator/configMap.go b/generator/configMap.go index 6bbbd4f..9af2d37 100644 --- a/generator/configMap.go +++ b/generator/configMap.go @@ -109,14 +109,14 @@ func NewConfigMap(service types.ServiceConfig, appName string, forFile bool) *Co done[key] = true } } - } - for key, env := range service.Environment { - _, isDropped := drop[key] - _, isDone := done[key] - if isDropped || isDone { - continue + for key, env := range service.Environment { + _, isDropped := drop[key] + _, isDone := done[key] + if isDropped || isDone { + continue + } + cm.AddData(key, *env) } - cm.AddData(key, *env) } return cm @@ -168,7 +168,6 @@ func (c *ConfigMap) AppendDir(path string) { if err != nil { log.Fatalf("Path %s does not exist\n", path) } - log.Printf("Appending files from %s to configmap\n", path) // recursively read all files in the path and add them to the configmap if stat.IsDir() { files, err := os.ReadDir(path)