Allow node name to stay in the env if referenced in config
@@ -133,6 +133,10 @@ var envVarRE = regexp.MustCompile(`\${\s*([\w-]+?)\s*}`)
// still get to them when we need to rerender config
var envVarCache = make(map[string]string)
+var envVarWhitelist = map[string]bool{
+ "MY_NODE_NAME": true,
+}
+
// Replaces envvar syntax with the actual envvars
func preprocessConfig(content []byte) []byte {
return envVarRE.ReplaceAllFunc(content, func(bs []byte) []byte {
@@ -149,8 +153,10 @@ func preprocessConfig(content []byte) []byte {
"envvar": envvar,
}).Debug("Sanitizing envvar from agent")
+ if !envVarWhitelist[envvar] {
os.Unsetenv(envvar)
}
+ }
return []byte(val)
})
