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

17 lines
420 B
Python
Raw Normal View History

2022-08-02 22:50:16 +03:00
"""MiniHuey singleton."""
2022-08-11 02:36:36 +03:00
from huey import SqliteHuey
2022-08-02 22:50:16 +03:00
2022-08-11 02:36:36 +03: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