Skip to content

Commit 235990e

Browse files
authored
Merge pull request #554 from nokia/proc-env
Do not env expand regex fields
2 parents 6e01da4 + 05406d0 commit 235990e

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

pkg/config/environment.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,27 +90,27 @@ func expandMapEnv(m map[string]interface{}, fn func(string, string) string) {
9090
for i, item := range v {
9191
switch item := item.(type) {
9292
case string:
93-
v[i] = os.ExpandEnv(item)
93+
v[i] = fn(f, item)
9494
case map[string]interface{}:
9595
expandMapEnv(item, fn)
9696
case []any:
97-
expandSliceEnv(item, fn)
97+
expandSliceEnv(f, item, fn)
9898
}
9999
}
100100
m[f] = v
101101
}
102102
}
103103
}
104104

105-
func expandSliceEnv(s []any, fn func(string, string) string) {
105+
func expandSliceEnv(parent string, s []any, fn func(string, string) string) {
106106
for i, item := range s {
107107
switch item := item.(type) {
108108
case string:
109-
s[i] = os.ExpandEnv(item)
109+
s[i] = fn(parent, item)
110110
case map[string]interface{}:
111111
expandMapEnv(item, fn)
112112
case []any:
113-
expandSliceEnv(item, fn)
113+
expandSliceEnv("", item, fn)
114114
}
115115
}
116116
}

pkg/config/processors.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@ func (c *Config) GetEventProcessors() (map[string]map[string]interface{}, error)
3939
c.Processors[n] = es
4040
}
4141
for n := range c.Processors {
42-
expandMapEnv(c.Processors[n], expandExcept("expression", "condition"))
42+
expandMapEnv(c.Processors[n], expandExcept(
43+
"expression",
44+
"condition",
45+
"value-names", "values",
46+
"tag-names", "tags",
47+
"old", "new", // strings.replace
48+
"source", // starlark
49+
))
4350
}
4451
if c.Debug {
4552
c.logger.Printf("processors: %+v", c.Processors)

0 commit comments

Comments
 (0)