selfprivacy-rest-api/selfprivacy_api/utils/huey.py

17 lines
420 B
Python
Raw Normal View History

2022-08-02 19:50:16 +00:00
"""MiniHuey singleton."""
2022-08-10 23:36:36 +00:00
from huey import SqliteHuey
2022-08-02 19:50:16 +00:00
2022-08-10 23:36:36 +00:00
HUEY_DATABASE = "/etc/nixos/userdata/tasks.db"
# Singleton instance containing the huey database.
class Huey:
"""Huey singleton."""
__instance = None
def __new__(cls):
"""Create a new instance of the huey singleton."""
if Huey.__instance is None:
Huey.__instance = SqliteHuey(HUEY_DATABASE)
return Huey.__instance