From f31407dd7ef918bcc4c0c6c6008d16a8c3b3b338 Mon Sep 17 00:00:00 2001 From: Jacky Date: Thu, 24 Apr 2025 08:44:30 +0000 Subject: [PATCH] fix(cache): index dir --- internal/cache/index.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/internal/cache/index.go b/internal/cache/index.go index 7acd5250..11907f0a 100644 --- a/internal/cache/index.go +++ b/internal/cache/index.go @@ -50,6 +50,11 @@ func init() { // InitScanner initializes the config scanner func InitScanner() { + if nginx.GetConfPath() == "" { + logger.Error("Nginx config path is not set") + return + } + s := GetScanner() err := s.Initialize() if err != nil { @@ -154,11 +159,11 @@ func (s *Scanner) Initialize() error { } // Setup watcher for config directory - configDir := filepath.Dir(nginx.GetConfPath("", "")) - availableDir := nginx.GetConfPath("sites-available", "") - enabledDir := nginx.GetConfPath("sites-enabled", "") - streamAvailableDir := nginx.GetConfPath("stream-available", "") - streamEnabledDir := nginx.GetConfPath("stream-enabled", "") + configDir := filepath.Dir(nginx.GetConfPath()) + availableDir := nginx.GetConfPath("sites-available") + enabledDir := nginx.GetConfPath("sites-enabled") + streamAvailableDir := nginx.GetConfPath("stream-available") + streamEnabledDir := nginx.GetConfPath("stream-enabled") // Watch the main directories err = s.watcher.Add(configDir)