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.
This commit is contained in:
@@ -109,14 +109,14 @@ func NewConfigMap(service types.ServiceConfig, appName string, forFile bool) *Co
|
|||||||
done[key] = true
|
done[key] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
for key, env := range service.Environment {
|
||||||
for key, env := range service.Environment {
|
_, isDropped := drop[key]
|
||||||
_, isDropped := drop[key]
|
_, isDone := done[key]
|
||||||
_, isDone := done[key]
|
if isDropped || isDone {
|
||||||
if isDropped || isDone {
|
continue
|
||||||
continue
|
}
|
||||||
|
cm.AddData(key, *env)
|
||||||
}
|
}
|
||||||
cm.AddData(key, *env)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cm
|
return cm
|
||||||
@@ -168,7 +168,6 @@ func (c *ConfigMap) AppendDir(path string) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Path %s does not exist\n", path)
|
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
|
// recursively read all files in the path and add them to the configmap
|
||||||
if stat.IsDir() {
|
if stat.IsDir() {
|
||||||
files, err := os.ReadDir(path)
|
files, err := os.ReadDir(path)
|
||||||
|
Reference in New Issue
Block a user