1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-05 21:45:25 +02:00

feat: allow overriding of some absolute paths using environment variables (#3102)
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Docker Nightly Production / Backend Server Tests (push) Waiting to run
Docker Nightly Production / Frontend and End-to-End Tests (push) Waiting to run
Docker Nightly Production / Build Tagged Release (push) Blocked by required conditions
Docker Nightly Production / Notify Discord (push) Blocked by required conditions

* 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:
Litchi Pi 2024-02-13 20:30:07 +01:00 committed by GitHub
parent fb9be66f97
commit 3d73e7498f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View file

@ -1,3 +1,4 @@
import os
from collections.abc import Callable
from pathlib import Path
from time import sleep
@ -87,7 +88,12 @@ def main():
if max_retry == 0:
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):
logger.debug("Migration not needed.")
else:

View file

@ -1,3 +1,4 @@
import os
import subprocess
import tempfile
from fractions import Fraction
@ -13,7 +14,7 @@ from . import utils
from .pre_processor import pre_process_string
CWD = Path(__file__).parent
MODEL_PATH = CWD / "model.crfmodel"
MODEL_PATH = os.getenv("CRF_MODEL_PATH", default=CWD / "model.crfmodel")
class CRFConfidence(BaseModel):