Skip to content

Commit 77b2d2b

Browse files
committed
PR feedback
1 parent f78cd4a commit 77b2d2b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

internal/datasource/config/nginx_config_parser.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func (ncp *NginxConfigParser) createNginxConfigContext(
177177
case "app_protect_security_log":
178178
if len(directive.Args) > 1 {
179179
napEnabled = true
180-
sysLogServer := ncp.findValidSysLogServers(directive.Args[1])
180+
sysLogServer := ncp.findLocalSysLogServers(directive.Args[1])
181181
if sysLogServer != "" && !napSyslogServersFound[sysLogServer] {
182182
napSyslogServersFound[sysLogServer] = true
183183
slog.DebugContext(ctx, "Found NAP syslog server", "address", sysLogServer)
@@ -203,7 +203,7 @@ func (ncp *NginxConfigParser) createNginxConfigContext(
203203
}
204204

205205
if len(napSyslogServersFound) > 0 {
206-
syslogServer := ncp.parseSyslogDirective(ctx, napSyslogServersFound)
206+
syslogServer := ncp.findAvailableSyslogServers(ctx, napSyslogServersFound)
207207
if syslogServer != "" {
208208
nginxConfigContext.NAPSysLogServer = syslogServer
209209
ncp.previousNAPSysLogServer = syslogServer
@@ -224,7 +224,7 @@ func (ncp *NginxConfigParser) createNginxConfigContext(
224224
return nginxConfigContext, nil
225225
}
226226

227-
func (ncp *NginxConfigParser) parseSyslogDirective(ctx context.Context, napSyslogServers map[string]bool) string {
227+
func (ncp *NginxConfigParser) findAvailableSyslogServers(ctx context.Context, napSyslogServers map[string]bool) string {
228228
if ncp.previousNAPSysLogServer != "" {
229229
if _, ok := napSyslogServers[ncp.previousNAPSysLogServer]; ok {
230230
return ncp.previousNAPSysLogServer
@@ -249,7 +249,7 @@ func (ncp *NginxConfigParser) parseSyslogDirective(ctx context.Context, napSyslo
249249
return ""
250250
}
251251

252-
func (ncp *NginxConfigParser) findValidSysLogServers(sysLogServer string) string {
252+
func (ncp *NginxConfigParser) findLocalSysLogServers(sysLogServer string) string {
253253
re := regexp.MustCompile(`syslog:server=([\S]+)`)
254254
matches := re.FindStringSubmatch(sysLogServer)
255255
if len(matches) > 1 {

internal/datasource/config/nginx_config_parser_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ func TestNginxConfigParser_findValidSysLogServers(t *testing.T) {
719719
ncp := NewNginxConfigParser(types.AgentConfig())
720720

721721
for i, server := range servers {
722-
result := ncp.findValidSysLogServers(server)
722+
result := ncp.findLocalSysLogServers(server)
723723

724724
assert.Equal(t, expected[i], result)
725725
}

0 commit comments

Comments
 (0)