add initial configuration, replace get_configuration with toml.load to avoid validation error on aerich init

This commit is contained in:
magowiz 2021-12-04 18:24:09 +01:00
parent 653d98e076
commit b04b0ba923
2 changed files with 9 additions and 4 deletions

5
aerich.ini Normal file
View File

@ -0,0 +1,5 @@
[aerich]
tortoise_orm = mobilizon_reshare.aerich_conf.database.TORTOISE_ORM
location = ./migrations
src_folder = ./.

View File

@ -1,11 +1,11 @@
"""tortoise orm conf for aerich"""
from pathlib import Path
from mobilizon_reshare.config.config import get_settings
import toml
CONF_FILE = "settings.toml"
CONF_FILE = "mobilizon_reshare/settings.toml"
SETTINGS = get_settings(CONF_FILE)
db_path = Path(SETTINGS.db_path)
SETTINGS = toml.load(CONF_FILE)
db_path = Path(SETTINGS['default']['db_path'])
db_url = f"sqlite:///{db_path}"