Compare commits

...

2 Commits

Author SHA1 Message Date
ef8e1e6a81 fix: tzdata dep requirement
All checks were successful
ci / docker (push) Successful in 49s
2026-03-25 12:29:40 +01:00
6680f4769c fix: timezone support 2026-03-25 12:25:37 +01:00
2 changed files with 4 additions and 1 deletions

View File

@@ -6,3 +6,4 @@ waitress
requests requests
icinga2api icinga2api
psycopg2-binary psycopg2-binary
tzdata

View File

@@ -9,6 +9,7 @@ import datetime
import pytimeparse.timeparse as timeparse import pytimeparse.timeparse as timeparse
import sys import sys
import secrets import secrets
import zoneinfo
import flask_wtf import flask_wtf
from flask_wtf import FlaskForm from flask_wtf import FlaskForm
@@ -32,6 +33,7 @@ app = flask.Flask("Icinga Report In Gateway")
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('SQLALCHEMY_DATABASE_URI') or 'sqlite:///database.sqlite' app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('SQLALCHEMY_DATABASE_URI') or 'sqlite:///database.sqlite'
app.config['JSON_CONFIG_FILE'] = 'services.json' app.config['JSON_CONFIG_FILE'] = 'services.json'
app.config['JSON_CONFIG_DIR'] = 'config' app.config['JSON_CONFIG_DIR'] = 'config'
app.config['TIME_ZONE'] = zoneinfo.ZoneInfo(os.getenv("TIME_ZONE", "UTC"))
app.config['AUTH_HEADER'] = os.environ.get("AUTH_HEADER") or "X-Forwarded-Preferred-Username" app.config['AUTH_HEADER'] = os.environ.get("AUTH_HEADER") or "X-Forwarded-Preferred-Username"
db = SQLAlchemy(app) db = SQLAlchemy(app)
@@ -57,7 +59,7 @@ class Status(db.Model):
info_text = Column(String) info_text = Column(String)
def human_date(self): def human_date(self):
dt = datetime.datetime.fromtimestamp(self.timestamp) dt = datetime.datetime.fromtimestamp(self.timestamp, app.config["TIME_ZONE"])
return dt.strftime("%d. %B %Y at %H:%M") return dt.strftime("%d. %B %Y at %H:%M")
class SMARTStatus(db.Model): class SMARTStatus(db.Model):