Explorar o código

chore: use nginx.GetConfEntryPath() #1013

Jacky hai 2 meses
pai
achega
1ba1da0d5d

+ 3 - 3
internal/cache/index.go

@@ -348,7 +348,7 @@ func (s *Scanner) scanSingleFile(filePath string) error {
 			if strings.Contains(includePath, "*") {
 				// If it's a relative path, make it absolute based on nginx config dir
 				if !filepath.IsAbs(includePath) {
-					configDir := filepath.Dir(nginx.GetConfPath("", ""))
+					configDir := filepath.Dir(nginx.GetConfPath())
 					includePath = filepath.Join(configDir, includePath)
 				}
 
@@ -373,7 +373,7 @@ func (s *Scanner) scanSingleFile(filePath string) error {
 				// Handle single file include
 				// If it's a relative path, make it absolute based on nginx config dir
 				if !filepath.IsAbs(includePath) {
-					configDir := filepath.Dir(nginx.GetConfPath("", ""))
+					configDir := filepath.Dir(nginx.GetConfPath())
 					includePath = filepath.Join(configDir, includePath)
 				}
 
@@ -413,7 +413,7 @@ func (s *Scanner) ScanAllConfigs() error {
 	}()
 
 	// Get the main config file
-	mainConfigPath := nginx.GetConfPath("", "nginx.conf")
+	mainConfigPath := nginx.GetConfEntryPath()
 	err := s.scanSingleFile(mainConfigPath)
 	if err != nil {
 		logger.Error("Failed to scan main config:", err)

+ 1 - 1
internal/performance/config_info.go

@@ -51,7 +51,7 @@ func GetNginxWorkerConfigInfo() (*NginxConfigInfo, error) {
 		},
 	}
 
-	confPath := nginx.GetConfPath("nginx.conf")
+	confPath := nginx.GetConfEntryPath()
 	if confPath == "" {
 		return nil, errors.New("failed to get nginx.conf path")
 	}

+ 1 - 1
internal/performance/perf_opt.go

@@ -53,7 +53,7 @@ type PerfOpt struct {
 
 // UpdatePerfOpt updates the Nginx performance optimization settings
 func UpdatePerfOpt(opt *PerfOpt) error {
-	confPath := nginx.GetConfPath("nginx.conf")
+	confPath := nginx.GetConfEntryPath()
 	if confPath == "" {
 		return errors.New("failed to get nginx.conf path")
 	}