Bussy-boy/data.py

17 lines
356 B
Python

import os
import yaml
from sqlitedict import SqliteDict
current_dir = os.path.dirname(os.path.realpath(__file__))
config_path = os.path.join(current_dir, "config.yaml")
def load_config():
with open(config_path, "r") as f:
return yaml.safe_load(f)
config = load_config()
db = SqliteDict(f"{config['data_dir']}/db.sqlite", autocommit=True)