mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-09 03:04:54 -04:00
feat: allow overriding of some absolute paths using environment variables (#3102)
* Allow overriding of alembic config file path using environment variable Signed-off-by: Litchi Pi <litchi.pi@proton.me> * Allow overriding of MODEL_PATH using environment variable Signed-off-by: Litchi Pi <litchi.pi@proton.me> --------- Signed-off-by: Litchi Pi <litchi.pi@proton.me>
This commit is contained in:
parent
fb9be66f97
commit
3d73e7498f
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from time import sleep
|
from time import sleep
|
||||||
@ -87,7 +88,12 @@ def main():
|
|||||||
if max_retry == 0:
|
if max_retry == 0:
|
||||||
raise ConnectionError("Database connection failed - exiting application.")
|
raise ConnectionError("Database connection failed - exiting application.")
|
||||||
|
|
||||||
alembic_cfg = Config(str(PROJECT_DIR / "alembic.ini"))
|
alembic_cfg_path = os.getenv("ALEMBIC_CONFIG_FILE", default=str(PROJECT_DIR / "alembic.ini"))
|
||||||
|
|
||||||
|
if not os.path.isfile(alembic_cfg_path):
|
||||||
|
raise Exception("Provided alembic config path doesn't exist")
|
||||||
|
|
||||||
|
alembic_cfg = Config(alembic_cfg_path)
|
||||||
if db_is_at_head(alembic_cfg):
|
if db_is_at_head(alembic_cfg):
|
||||||
logger.debug("Migration not needed.")
|
logger.debug("Migration not needed.")
|
||||||
else:
|
else:
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
from fractions import Fraction
|
from fractions import Fraction
|
||||||
@ -13,7 +14,7 @@ from . import utils
|
|||||||
from .pre_processor import pre_process_string
|
from .pre_processor import pre_process_string
|
||||||
|
|
||||||
CWD = Path(__file__).parent
|
CWD = Path(__file__).parent
|
||||||
MODEL_PATH = CWD / "model.crfmodel"
|
MODEL_PATH = os.getenv("CRF_MODEL_PATH", default=CWD / "model.crfmodel")
|
||||||
|
|
||||||
|
|
||||||
class CRFConfidence(BaseModel):
|
class CRFConfidence(BaseModel):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user