Add POSTGRES_ACTIVE flag

This commit is contained in:
2026-04-20 15:43:41 +03:00
parent a2bef13bc8
commit aa974ce1b4
3 changed files with 13 additions and 5 deletions
+10 -4
View File
@@ -17,6 +17,7 @@ POSTGRES_DB = os.getenv("POSTGRES_DB")
POSTGRES_PASS = os.getenv("POSTGRES_PASS")
POSTGRES_HOST = os.getenv("POSTGRES_HOST")
POSTGRES_PORT = os.getenv("POSTGRES_PORT")
POSTGRES_ACTIVE = os.getenv("POSTGRES_ACTIVE", "false").lower() == "true"
NEO_ACTIVE = os.getenv("NEO_ACTIVE", "false").lower() == "true"
NEO_USER = os.getenv("NEO_USER")
@@ -219,11 +220,11 @@ def load_users():
class MainWindow(QMainWindow):
def __init__(self):
def __init__(self, postgres_active):
super().__init__()
self.setMinimumSize(QSize(640, 480))
self.setWindowTitle("postgres")
self.setWindowTitle("postgres" if postgres_active else "postgres (disabled)")
central_widget = QWidget(self)
self.setCentralWidget(central_widget)
@@ -319,10 +320,15 @@ class DataWindow(QWidget):
if __name__ == "__main__":
users = load_users()
users = []
if POSTGRES_ACTIVE:
try:
users = load_users()
except Exception as error:
print(f"PostgreSQL load failed: {error}")
app = QApplication(sys.argv)
main_window = MainWindow()
main_window = MainWindow(POSTGRES_ACTIVE)
main_window.load_data(users)
main_window.show()