21 lines
384 B
Python
21 lines
384 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)
|
||
|
|
||
|
|
||
|
def open_database():
|
||
|
return SqliteDict("db.sqlite", autocommit=True)
|
||
|
|
||
|
|
||
|
config = load_config()
|
||
|
db = open_database()
|