diff --git a/docs/docs/documentation/getting-started/installation/backend-config.md b/docs/docs/documentation/getting-started/installation/backend-config.md index dce06309bc20..80f678b487f2 100644 --- a/docs/docs/documentation/getting-started/installation/backend-config.md +++ b/docs/docs/documentation/getting-started/installation/backend-config.md @@ -54,8 +54,8 @@ Changing the webworker settings may cause unforeseen memory leak issues with Mea | ---------------- | :-----: | --------------------------------------------------------------------------------------------------------------------------------- | | WEB_GUNICORN | false | Enables Gunicorn to manage Uvicorn web for multiple works | | WORKERS_PER_CORE | 1 | Set the number of workers to the number of CPU cores multiplied by this value (Value \* CPUs). More info [here][workers_per_core] | -| MAX_WORKERS | 1 | Set the maximum number of workers to use. Default is not set meaning unlimited. More info [here][max_workers] | -| WEB_CONCURRENCY | 1 | Override the automatic definition of number of workers. More info [here][web_concurrency] | +| MAX_WORKERS | None | Set the maximum number of workers to use. Default is not set meaning unlimited. More info [here][max_workers] | +| WEB_CONCURRENCY | 2 | Override the automatic definition of number of workers. More info [here][web_concurrency] | ### LDAP @@ -95,3 +95,8 @@ Setting the following environmental variables will change the theme of the front | THEME_DARK_INFO | #1976D2 | Dark Theme Config Variable | | THEME_DARK_WARNING | #FF6D00 | Dark Theme Config Variable | | THEME_DARK_ERROR | #EF5350 | Dark Theme Config Variable | + + +[workers_per_core]: https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/2daa3e3873c837d5781feb4ff6a40a89f791f81b/README.md#workers_per_core +[max_workers]: https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/2daa3e3873c837d5781feb4ff6a40a89f791f81b/README.md#max_workers +[web_concurrency]: https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/2daa3e3873c837d5781feb4ff6a40a89f791f81b/README.md#web_concurrency diff --git a/docs/docs/overrides/api.html b/docs/docs/overrides/api.html index 28fdc391d2c4..4e7f1d6d216f 100644 --- a/docs/docs/overrides/api.html +++ b/docs/docs/overrides/api.html @@ -14,7 +14,7 @@
diff --git a/frontend/components/Domain/Recipe/RecipeNutrition.vue b/frontend/components/Domain/Recipe/RecipeNutrition.vue index 9b90fe990bca..f53ea29bd866 100644 --- a/frontend/components/Domain/Recipe/RecipeNutrition.vue +++ b/frontend/components/Domain/Recipe/RecipeNutrition.vue @@ -19,11 +19,11 @@ - +
{{ item.label }}
-
{{ value[key] }}
+
{{ item.value }}
{{ item.suffix }}
@@ -37,6 +37,14 @@ import { computed, defineComponent, useContext } from "@nuxtjs/composition-api"; import { Nutrition } from "~/lib/api/types/recipe"; +type NutritionLabelType = { + [key: string]: { + label: string; + suffix: string; + value?: string; + }; +}; + export default defineComponent({ props: { value: { @@ -50,34 +58,34 @@ export default defineComponent({ }, setup(props, context) { const { i18n } = useContext(); - const labels = { + const labels = { calories: { - label: i18n.t("recipe.calories"), - suffix: i18n.t("recipe.calories-suffix"), + label: i18n.tc("recipe.calories"), + suffix: i18n.tc("recipe.calories-suffix"), }, fatContent: { - label: i18n.t("recipe.fat-content"), - suffix: i18n.t("recipe.grams"), + label: i18n.tc("recipe.fat-content"), + suffix: i18n.tc("recipe.grams"), }, fiberContent: { - label: i18n.t("recipe.fiber-content"), - suffix: i18n.t("recipe.grams"), + label: i18n.tc("recipe.fiber-content"), + suffix: i18n.tc("recipe.grams"), }, proteinContent: { - label: i18n.t("recipe.protein-content"), - suffix: i18n.t("recipe.grams"), + label: i18n.tc("recipe.protein-content"), + suffix: i18n.tc("recipe.grams"), }, sodiumContent: { - label: i18n.t("recipe.sodium-content"), - suffix: i18n.t("recipe.milligrams"), + label: i18n.tc("recipe.sodium-content"), + suffix: i18n.tc("recipe.milligrams"), }, sugarContent: { - label: i18n.t("recipe.sugar-content"), - suffix: i18n.t("recipe.grams"), + label: i18n.tc("recipe.sugar-content"), + suffix: i18n.tc("recipe.grams"), }, carbohydrateContent: { - label: i18n.t("recipe.carbohydrate-content"), - suffix: i18n.t("recipe.grams"), + label: i18n.tc("recipe.carbohydrate-content"), + suffix: i18n.tc("recipe.grams"), }, }; const valueNotNull = computed(() => { @@ -96,11 +104,25 @@ export default defineComponent({ context.emit("input", { ...props.value, [key]: event }); } + // Build a new list that only contains nutritional information that has a value + const renderedList = computed(() => { + return Object.entries(labels).reduce((item: NutritionLabelType, [key, label]) => { + if (props.value[key]?.trim()) { + item[key] = { + ...label, + value: props.value[key], + }; + } + return item; + }, {}); + }); + return { labels, valueNotNull, showViewer, updateValue, + renderedList, }; }, }); diff --git a/mealie/db/init_db.py b/mealie/db/init_db.py index 1fcefe1c21bf..6f94ee962023 100644 --- a/mealie/db/init_db.py +++ b/mealie/db/init_db.py @@ -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: diff --git a/mealie/services/parser_services/crfpp/processor.py b/mealie/services/parser_services/crfpp/processor.py index 5c114732f31a..8ca936885386 100644 --- a/mealie/services/parser_services/crfpp/processor.py +++ b/mealie/services/parser_services/crfpp/processor.py @@ -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):