Skip to content

Commit

Permalink
Feat: Update BASE_HREF in AIO
Browse files Browse the repository at this point in the history
  • Loading branch information
TomBursch committed Dec 4, 2024
1 parent 14d4bea commit 481386a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
15 changes: 15 additions & 0 deletions backend/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ if [ ! -f "/proc/net/if_inet6" ]; then
sed -i 's/\[::\]//g' /usr/src/kitchenowl/wsgi.ini
fi

# patch the web base href if requested
if [ ! -z $BASE_HREF ]; then
if [[ $BASE_HREF == *"#"* ]]; then
echo "$ME: error: BASE_HREF must not contain character '#'" >&2
exit 1
elif [[ $BASE_HREF != "/"* ]]; then
echo "$ME: error: BASE_HREF must begin with a forward slash: /example/" >&2
exit 1
elif [[ $BASE_HREF != *"/" ]]; then
echo "$ME: error: BASE_HREF must end with a forward slash: /example/" >&2
exit 1
fi
sed -i "s#<base href=\"/\">#<base href=\"${BASE_HREF}\">#g" /var/www/web/kitchenowl/index.html
fi

mkdir -p $STORAGE_PATH/upload
flask db upgrade
if [ "${SKIP_UPGRADE_DEFAULT_ITEMS}" != "true" ] && [ "${SKIP_UPGRADE_DEFAULT_ITEMS}" != "True" ]; then
Expand Down
8 changes: 5 additions & 3 deletions docs/docs/self-hosting/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Environment variables for `tombursch/kitchenowl` and `tombursch/kitchenowl-backe
| `GOOGLE_CLIENT_ID` | | |
| `GOOGLE_CLIENT_SECRET` | | |
| `LLM_MODEL` | | Set a custom ingredient detection strategy for scraped recipes from the web. More at [Ingredient Parsing](./ingredient_parsing.md) |
| `BASE_HREF` | | Sets the subdirectory KitchenOwl is hosted at. Must begin and end with a slash `/`. Only applicable to `tombursch/kitchenowl` |

Additionally, to setting these environment variables you can also override the start command to scale the backend up.
Add the following line or take a look at this exemplary [docker-compose.yml](https://github.com/TomBursch/kitchenowl/blob/main/docker-compose-postgres.yml) file:
Expand All @@ -66,9 +67,10 @@ Overriding the command is not recommended as we might change the underlying proc

Environment variables for `tombursch/kitchenowl-web`:

| Variable | Default | Description |
| ---------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `BACK_URL` | `back:5000` | Allows to set a custom address for the backend. Needs to be an uWSGI protocol endpoint. Should correspond to the name or IP of the backend container and port `5000` |
| Variable | Default | Description |
| ----------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `BACK_URL` | `back:5000` | Allows to set a custom address for the backend. Needs to be an uWSGI protocol endpoint. Should correspond to the name or IP of the backend container and port `5000` |
| `BASE_HREF` | | Sets the subdirectory KitchenOwl is hosted at. Must begin and end with a slash `/`. |

## Multiservice Setup

Expand Down

0 comments on commit 481386a

Please sign in to comment.