Explorar o código

feat(config): remove timezone setting from config and update installation script to include tzdata

Manuel hai 9 meses
pai
achega
0eff3aa3b1
Modificáronse 3 ficheiros con 6 adicións e 9 borrados
  1. 2 1
      .github/workflows/test-install.yml
  2. 4 5
      app.py
  3. 0 3
      config.py

+ 2 - 1
.github/workflows/test-install.yml

@@ -50,7 +50,8 @@ jobs:
             openrc \
             sudo \
             procps \
-            grep
+            grep \
+            tzdata
         else
           # Configurar entorno no interactivo para Ubuntu/Debian
           export DEBIAN_FRONTEND=noninteractive

+ 4 - 5
app.py

@@ -3,10 +3,11 @@ import os
 import signal
 import sys
 import threading
-from datetime import datetime, timedelta
+from datetime import datetime, timedelta, timezone
 
 from dotenv import load_dotenv
 from flask import Flask
+from apscheduler.schedulers.background import BackgroundScheduler
 from flask_apscheduler import APScheduler
 from flask_socketio import SocketIO
 
@@ -75,11 +76,9 @@ def create_app():
     # Initialize CSRF protection (shared instance with routes)
     csrf.init_app(app)
 
-    # Set timezone for APScheduler before initialization
-    os.environ['TZ'] = Config.TZ
-
     # Initialize extensions
-    scheduler = APScheduler()
+    # Pass explicit timezone to avoid tzlocal.get_localzone() failures in containers
+    scheduler = APScheduler(scheduler=BackgroundScheduler(timezone=timezone.utc))
     scheduler.init_app(app)
     scheduler.start()
 

+ 0 - 3
config.py

@@ -145,8 +145,5 @@ class Config:
     HTTPS_PROXY = safe_get_env("HTTPS_PROXY", "")
     NO_PROXY = safe_get_env("NO_PROXY", "")
 
-    # Timezone setting
-    TZ = safe_get_env("TZ", "Etc/UTC")
-
     # Squid configuration path
     SQUID_CONFIG_PATH = safe_get_env("SQUID_CONFIG_PATH", "/etc/squid/squid.conf")