From 475ee1cc9023d51ab477b3bcf6411cf587451cb5 Mon Sep 17 00:00:00 2001 From: w Date: Sun, 18 May 2025 17:28:15 -0300 Subject: [PATCH] Move database location to config --- bot/config.py | 3 +++ bot/db_utils.py | 4 ++-- example_config.ini | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bot/config.py b/bot/config.py index 475aab9..b24293c 100644 --- a/bot/config.py +++ b/bot/config.py @@ -11,6 +11,9 @@ KEY = config['application']['ApiKey'] # Bot's Misskey instance URL INSTANCE = config['application']['InstanceUrl'] +# SQLite Database location +DB_PATH = config['application']['DatabaseLocation'] + # Extra stuff for control of the bot # TODO: move this to db diff --git a/bot/db_utils.py b/bot/db_utils.py index a143f4a..bb80d98 100644 --- a/bot/db_utils.py +++ b/bot/db_utils.py @@ -1,8 +1,8 @@ import sqlite3 import random +import config -# TODO: grab this from a config file instead -DB_PATH = "./gacha_game.db" # Adjust if needed +DB_PATH = config.DB_PATH def get_db_connection(): '''Creates a connection to the database''' diff --git a/example_config.ini b/example_config.ini index fe18f06..4412c92 100644 --- a/example_config.ini +++ b/example_config.ini @@ -12,3 +12,6 @@ InstanceUrl = http://example.tld ; Comma separated list of fedi handles for any administrator users DefaultAdmins = ['admin@example.tld'] + +; SQLite Database location +DatabaseLocation = ./gacha_game.db \ No newline at end of file -- 2.36.2