mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-09 03:04:54 -04:00
fix: Use env variable to get alembic config file in exporter (#3882)
Signed-off-by: Litchi Pi <litchi.pi@proton.me>
This commit is contained in:
parent
d0f8b5773d
commit
3b81d3b18a
@ -1,4 +1,5 @@
|
|||||||
import datetime
|
import datetime
|
||||||
|
import os
|
||||||
import uuid
|
import uuid
|
||||||
from os import path
|
from os import path
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -151,7 +152,12 @@ class AlchemyExporter(BaseService):
|
|||||||
alembic_data = db_dump["alembic_version"]
|
alembic_data = db_dump["alembic_version"]
|
||||||
alembic_version = alembic_data[0]["version_num"]
|
alembic_version = alembic_data[0]["version_num"]
|
||||||
|
|
||||||
alembic_cfg = Config(str(PROJECT_DIR / "alembic.ini"))
|
alembic_cfg_path = os.getenv("ALEMBIC_CONFIG_FILE", default=str(PROJECT_DIR / "alembic.ini"))
|
||||||
|
|
||||||
|
if not path.isfile(alembic_cfg_path):
|
||||||
|
raise Exception("Provided alembic config path doesn't exist")
|
||||||
|
|
||||||
|
alembic_cfg = Config(alembic_cfg_path)
|
||||||
# alembic's file resolver wants to use the "mealie" subdirectory when called from within the server package
|
# alembic's file resolver wants to use the "mealie" subdirectory when called from within the server package
|
||||||
# Just override this to use the correct migrations path
|
# Just override this to use the correct migrations path
|
||||||
alembic_cfg.set_main_option("script_location", path.join(PROJECT_DIR, "alembic"))
|
alembic_cfg.set_main_option("script_location", path.join(PROJECT_DIR, "alembic"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user