File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -15,10 +15,14 @@ import (
15
15
)
16
16
17
17
// Regular expression for log directives - matches access_log or error_log
18
- var logDirectiveRegex = regexp .MustCompile (`(?m)(access_log|error_log)\s+([^\s;]+)(?:\s+[^;]+)?;` )
18
+ var (
19
+ logDirectiveRegex = regexp .MustCompile (`(?m)(access_log|error_log)\s+([^\s;]+)(?:\s+[^;]+)?;` )
20
+ prefix = ""
21
+ )
19
22
20
23
// Use init function to automatically register callback
21
24
func init () {
25
+ prefix = nginx .GetPrefix ()
22
26
// Register the callback directly with the global registry
23
27
cache .RegisterCallback (scanForLogDirectives )
24
28
}
@@ -32,7 +36,6 @@ func scanForLogDirectives(configPath string, content []byte) error {
32
36
// Find log directives using regex
33
37
matches := logDirectiveRegex .FindAllSubmatch (content , - 1 )
34
38
35
- prefix := nginx .GetPrefix ()
36
39
// Parse log paths
37
40
for _ , match := range matches {
38
41
if len (match ) >= 3 {
You can’t perform that action at this time.
0 commit comments