]> apps.delaporte.us Git - matrix-chore-bot.git/blobdiff - matrix_chore_bot/db.py
Fixup
[matrix-chore-bot.git] / matrix_chore_bot / db.py
index c2735e4a79f110c7c27c92f657d2204101ff0f86..8467d32b0edeefcf1628831a394e534018dcfdb2 100644 (file)
@@ -8,8 +8,6 @@ from sqlmodel import Field, Session, SQLModel, create_engine, select, text
 # - [ ] add Vision FK
 # - [ ] add notes to each chore
 
 # - [ ] add Vision FK
 # - [ ] add notes to each chore
 
-CHORE_DB = os.environ.get('CHORE_DB')
-
 DATE_FORMAT = '%Y-%m-%d'
 
 def today():
 DATE_FORMAT = '%Y-%m-%d'
 
 def today():
@@ -38,7 +36,11 @@ def get_chore(session, chore_id):
     return session.exec(cmd).first()
 
 class Data():
     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()
 
         self.file = db_file
         self.engine = self.get_engine()