Move to QSettings for database credentials.

fixes: #1
This commit is contained in:
Christopher T. Johnson
2025-02-24 16:32:12 -05:00
parent f68e6c65cc
commit 92ad7efaad
5 changed files with 50 additions and 10 deletions

View File

@@ -2,6 +2,7 @@
import faulthandler
import sys
from PySide6.QtCore import QSettings
from PySide6.QtSql import (
QSqlDatabase,
)
@@ -9,6 +10,8 @@ from PySide6.QtWidgets import (
QApplication,
)
from lib.utils import openSettings
faulthandler.enable()
from MainWindow import MainWindow
@@ -17,11 +20,13 @@ from MainWindow import MainWindow
def main() -> int:
#
app = QApplication(sys.argv)
settings = openSettings('database')
db = QSqlDatabase.addDatabase("QMYSQL")
db.setHostName("ceph5")
db.setDatabaseName("scotus")
db.setUserName("scotus")
db.setPassword("lechOtvirf8Om/")
db.setHostName(settings.value("hostname"))
db.setDatabaseName(settings.value("databasename","scotus")) # type: ignore
db.setUserName(settings.value("user","scotus")) # type: ignore
db.setPassword(settings.value("password"))
settings.endGroup()
db.open()
import lib.dbConfig