check no '.' in stream/filter/action names

This commit is contained in:
ppom 2023-09-08 15:18:04 +02:00
parent 6a694d6bcb
commit 2bff4ef1b3

View File

@ -102,6 +102,10 @@ func (c *Conf) setup() {
stream := c.Streams[streamName] stream := c.Streams[streamName]
stream.name = streamName stream.name = streamName
if strings.Contains(stream.name, ".") {
log.Fatalln("FATAL Bad configuration: character '.' is not allowed in stream names", stream.name)
}
if len(stream.Filters) == 0 { if len(stream.Filters) == 0 {
log.Fatalln("FATAL Bad configuration: no filters configured in", stream.name) log.Fatalln("FATAL Bad configuration: no filters configured in", stream.name)
} }
@ -112,6 +116,9 @@ func (c *Conf) setup() {
filter.name = filterName filter.name = filterName
filter.matches = make(map[string][]time.Time) filter.matches = make(map[string][]time.Time)
if strings.Contains(filter.name, ".") {
log.Fatalln("FATAL Bad configuration: character '.' is not allowed in filter names", filter.name)
}
// Parse Duration // Parse Duration
if filter.RetryPeriod == "" { if filter.RetryPeriod == "" {
if filter.Retry > 1 { if filter.Retry > 1 {
@ -162,6 +169,9 @@ func (c *Conf) setup() {
action.filter = filter action.filter = filter
action.name = actionName action.name = actionName
if strings.Contains(action.name, ".") {
log.Fatalln("FATAL Bad configuration: character '.' is not allowed in action names", action.name)
}
// Parse Duration // Parse Duration
if action.After != "" { if action.After != "" {
afterDuration, err := time.ParseDuration(action.After) afterDuration, err := time.ParseDuration(action.After)