From e537c3083e58e18ce46252a7e5e7dfd30253e194 Mon Sep 17 00:00:00 2001 From: mst Date: Thu, 19 Sep 2024 18:34:51 +0300 Subject: [PATCH] 1.4.1-alpha - hotfix --- .env.example | 2 +- app.py | 6 +++++- constants.py | 2 +- functions.py | 2 ++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index b15a71b..4787593 100644 --- a/.env.example +++ b/.env.example @@ -2,6 +2,6 @@ DB_HOST = 127.0.0.1 DB_NAME = catask DB_USER = DB_PASS = -DB_PORT = +DB_PORT = 3306 ADMIN_PASSWORD = APP_SECRET = diff --git a/app.py b/app.py index 5990156..24182db 100644 --- a/app.py +++ b/app.py @@ -44,11 +44,15 @@ def initDatabase(): if error.errno == errorcode.ER_ACCESS_DENIED_ERROR: print("Bad credentials") elif error.errno == errorcode.ER_BAD_DB_ERROR: + dbPort = os.environ.get("DB_PORT") + if not dbPort: + dbPort = 3306 + conn = mysql.connector.connect( user=os.environ.get("DB_USER"), password=os.environ.get("DB_PASS"), host=os.environ.get("DB_HOST"), - port=os.environ.get("DB_PORT"), + port=dbPort, database='mysql' ) cursor = conn.cursor() diff --git a/constants.py b/constants.py index 7e7d823..1f2b26a 100644 --- a/constants.py +++ b/constants.py @@ -2,6 +2,6 @@ antiSpamFile = 'wordlist.txt' blacklistFile = 'word_blacklist.txt' configFile = 'config.json' appName = 'CatAsk' -version = '1.4.0' +version = '1.4.1' # id (identifier) is to be interpreted as described in https://semver.org/#spec-item-9 version_id = '-alpha' diff --git a/functions.py b/functions.py index 14b6620..3b5e6e8 100644 --- a/functions.py +++ b/functions.py @@ -44,6 +44,8 @@ dbUser = os.environ.get("DB_USER") dbPass = os.environ.get("DB_PASS") dbName = os.environ.get("DB_NAME") dbPort = os.environ.get("DB_PORT") +if not dbPort: + dbPort = 3306 def createDatabase(cursor, dbName): try: