Răsfoiți Sursa

Merge pull request #39 from wolfsouldev/fix--use-environment-variables-for-log-file-paths-in-view_logs-function

fix: :bug: use environment variables for log file paths in view_logs …
Kaelthas 1 an în urmă
părinte
comite
5b2bf5ba6c
3 a modificat fișierele cu 6 adăugiri și 1 ștergeri
  1. 1 0
      README.md
  2. 1 0
      README_es.md
  3. 4 1
      routes/admin_routes.py

+ 1 - 0
README.md

@@ -272,6 +272,7 @@ facebook.com,twitter.com,youtube.com,netflix.com,tiktok.com
    FLASK_DEBUG=True
    DATABASE_TYPE="SQLITE"
    SQUID_LOG="/var/log/squid/access.log"
+   SQUID_CACHE_LOG="/var/log/squid/cache.log"
    DATABASE_STRING_CONNECTION="/opt/SquidStats/"
    REFRESH_INTERVAL=60
    BLACKLIST_DOMAINS="facebook.com,twitter.com,instagram.com,tiktok.com,youtube.com,netflix.com"

+ 1 - 0
README_es.md

@@ -272,6 +272,7 @@ facebook.com,twitter.com,youtube.com,netflix.com,tiktok.com
    FLASK_DEBUG=True
    DATABASE_TYPE="SQLITE"
    SQUID_LOG="/var/log/squid/access.log"
+   SQUID_CACHE_LOG="/var/log/squid/cache.log"
    DATABASE_STRING_CONNECTION="/opt/SquidStats/"
    REFRESH_INTERVAL=60
    BLACKLIST_DOMAINS="facebook.com,twitter.com,instagram.com,tiktok.com,youtube.com,netflix.com"

+ 4 - 1
routes/admin_routes.py

@@ -181,7 +181,10 @@ def manage_http_access():
 
 @admin_bp.route("/view-logs")
 def view_logs():
-    log_files = ["/var/log/squid/access.log", "/var/log/squid/cache.log"]
+    log_files = [
+        os.getenv("SQUID_LOG", "/var/log/squid/access.log"),
+        os.getenv("SQUID_CACHE_LOG", "/var/log/squid/cache.log"),
+    ]
     logs = {}
     for log_file in log_files:
         try: