summaryrefslogtreecommitdiff
path: root/include/py/homekit/database/sqlite.py
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2023-06-11 05:03:43 +0300
committerEvgeny Zinoviev <me@ch1p.io>2023-06-11 05:03:43 +0300
commit62ee71fdb0eb07adbf0071103617aa96c993fe22 (patch)
tree07a5d7ec63c66efcf3162a388f22f371367000f7 /include/py/homekit/database/sqlite.py
parentba321657e0e724082df206857f80ca08c4d999dc (diff)
ipcam: start porting to new config and multiserver scheme
Diffstat (limited to 'include/py/homekit/database/sqlite.py')
-rw-r--r--include/py/homekit/database/sqlite.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/include/py/homekit/database/sqlite.py b/include/py/homekit/database/sqlite.py
index 0af1f54..8b0c44c 100644
--- a/include/py/homekit/database/sqlite.py
+++ b/include/py/homekit/database/sqlite.py
@@ -15,10 +15,13 @@ def _get_database_path(name: str) -> str:
class SQLiteBase:
SCHEMA = 1
- def __init__(self, name=None, check_same_thread=False):
- if name is None:
- name = config.app_config['database_name']
- database_path = _get_database_path(name)
+ def __init__(self, name=None, path=None, check_same_thread=False):
+ if not path:
+ if not name:
+ name = config.app_config['database_name']
+ database_path = _get_database_path(name)
+ else:
+ database_path = path
if not os.path.exists(os.path.dirname(database_path)):
os.makedirs(os.path.dirname(database_path))