Enhance database connection handling in BotDB class with error checking for file existence and access permissions. Implement methods for database integrity checks and WAL file cleanup. Update database initialization to use absolute project path for improved reliability.
This commit is contained in:
@@ -14,7 +14,9 @@ class BaseDependencyFactory:
|
||||
self.config = configparser.ConfigParser()
|
||||
self.config.read(config_path)
|
||||
self.settings = {}
|
||||
self.database = BotDB(current_dir, 'tg-bot-database.db')
|
||||
# Используем абсолютный путь к директории проекта
|
||||
project_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
self.database = BotDB(project_dir, 'tg-bot-database.db')
|
||||
|
||||
for section in self.config.sections():
|
||||
self.settings[section] = {}
|
||||
|
||||
Reference in New Issue
Block a user