diff --git a/internal/site/status.go b/internal/site/status.go index 3d2f9ff5..ec87fdc5 100644 --- a/internal/site/status.go +++ b/internal/site/status.go @@ -3,19 +3,26 @@ package site import ( "github.com/0xJacky/Nginx-UI/internal/helper" "github.com/0xJacky/Nginx-UI/internal/nginx" + "github.com/uozi-tech/cosy/logger" ) // GetSiteStatus returns the status of the site func GetSiteStatus(name string) Status { enabledFilePath := nginx.GetConfSymlinkPath(nginx.GetConfPath("sites-enabled", name)) - if helper.FileExists(enabledFilePath) { + enabledExists := helper.FileExists(enabledFilePath) + if enabledExists { return StatusEnabled } mantainanceFilePath := nginx.GetConfPath("sites-enabled", name+MaintenanceSuffix) - if helper.FileExists(mantainanceFilePath) { + maintenanceExists := helper.FileExists(mantainanceFilePath) + if maintenanceExists { return StatusMaintenance } + logger.Debugf( + "Site %s considered disabled (enabledPath=%s exists=%t, maintenancePath=%s exists=%t)", + name, enabledFilePath, enabledExists, mantainanceFilePath, maintenanceExists, + ) return StatusDisabled } diff --git a/internal/sitecheck/checker.go b/internal/sitecheck/checker.go index db227193..049fb8cb 100644 --- a/internal/sitecheck/checker.go +++ b/internal/sitecheck/checker.go @@ -101,20 +101,20 @@ func (sc *SiteChecker) CollectSites() { // Check site status - only collect from enabled sites siteStatus := site.GetSiteStatus(siteName) if siteStatus != site.StatusEnabled { - // logger.Debugf("Skipping site %s (status: %s) - only collecting from enabled sites", siteName, siteStatus) + logger.Debugf("Skipping site %s (status: %s) - only collecting from enabled sites", siteName, siteStatus) continue } - // logger.Debugf("Processing enabled site: %s with %d URLs", siteName, len(indexedSite.Urls)) + logger.Debugf("Processing enabled site: %s with %d URLs", siteName, len(indexedSite.Urls)) for _, url := range indexedSite.Urls { if url != "" { - // logger.Debugf("Adding site URL: %s", url) + logger.Debugf("Adding site URL: %s", url) // Load site config to determine display URL config, err := LoadSiteConfig(url) protocol := "http" // default protocol if err == nil && config != nil && config.HealthCheckConfig != nil && config.HealthCheckConfig.Protocol != "" { protocol = config.HealthCheckConfig.Protocol - // logger.Debugf("Site %s using protocol: %s", url, protocol) + logger.Debugf("Site %s using protocol: %s", url, protocol) } else { logger.Debugf("Site %s using default protocol: %s (config error: %v)", url, protocol, err) }