X-Git-Url: https://apps.delaporte.us/gitweb/matrix-chore-bot.git/blobdiff_plain/577bad16ed9bf9a1128bcffbd4aafb7c1be85f38..68b00c8ecbd23b7eed4d0942aa8b45f89f2810e0:/matrix_chore_bot/db.py?ds=inline diff --git a/matrix_chore_bot/db.py b/matrix_chore_bot/db.py index c2735e4..315d279 100644 --- a/matrix_chore_bot/db.py +++ b/matrix_chore_bot/db.py @@ -8,8 +8,6 @@ from sqlmodel import Field, Session, SQLModel, create_engine, select, text # - [ ] add Vision FK # - [ ] add notes to each chore -CHORE_DB = os.environ.get('CHORE_DB') - DATE_FORMAT = '%Y-%m-%d' def today(): @@ -38,7 +36,11 @@ def get_chore(session, chore_id): return session.exec(cmd).first() class Data(): - def __init__(self, db_file = CHORE_DB): + def __init__(self, db_file=None): + + if not db_file: + db_file = os.path.join(os.environ.get('MATRIX_DATA_DIR'), 'chores.db') + self.file = db_file self.engine = self.get_engine()