disable SSL connection to PostgreSQL

This commit is contained in:
Maximilian Keßler 2024-10-07 14:49:29 +02:00
parent a944bda70e
commit dca46364d3
2 changed files with 3 additions and 3 deletions

View file

@ -87,8 +87,8 @@ class DBConnectionManager:
logger.info("Initialised default config file {}".format(self.config_file)) logger.info("Initialised default config file {}".format(self.config_file))
def connect(self): def connect(self):
conn = psycopg2.connect("dbname='{}' user='{}' password='{}' host='localhost'".format( conn = psycopg2.connect("dbname='{}' user='{}' password='{}' host='localhost' sslmode='disable'".format(
self.db_name, self.db_user, self.db_pass) self.db_name, self.db_user, self.db_pass),
) )
cur = conn.cursor() cur = conn.cursor()
self.lazy_conn.set_conn(conn) self.lazy_conn.set_conn(conn)

View file

@ -250,12 +250,12 @@ def _process_game_row(game: Dict, var_id, export_all_games: bool = False):
"ON CONFLICT (id) DO NOTHING", "ON CONFLICT (id) DO NOTHING",
(game_id, seed, num_players, score, var_id) (game_id, seed, num_players, score, var_id)
) )
database.cur.execute("RELEASE seed_insert")
except psycopg2.errors.ForeignKeyViolation: except psycopg2.errors.ForeignKeyViolation:
# Sometimes, seed is not present in the database yet, then we will have to query the full game details # Sometimes, seed is not present in the database yet, then we will have to query the full game details
# (including the seed) to export it accordingly # (including the seed) to export it accordingly
database.cur.execute("ROLLBACK TO seed_insert") database.cur.execute("ROLLBACK TO seed_insert")
detailed_export_game(game_id, score=score, var_id=var_id) detailed_export_game(game_id, score=score, var_id=var_id)
database.cur.execute("RELEASE seed_insert")
# Insert participants into database # Insert participants into database
ids = ensure_users_in_db_and_get_ids(users) ids = ensure_users_in_db_and_get_ids(users)