feat: add option to disable Caddy in the Docker container

This commit is contained in:
Elias Schneider
2025-02-05 18:14:49 +01:00
parent c6ab2b252c
commit e864d5dcbf
2 changed files with 13 additions and 8 deletions

View File

@@ -4,7 +4,7 @@ id: environment-variables
# Environment Variables
Below are all the environment variables supported by Pocket ID. These should be configured in your `.env ` file.
Below are all the environment variables supported by Pocket ID. These should be configured in your `.env ` file.
Be cautious when modifying environment variables that are not recommended to change.
@@ -21,5 +21,6 @@ Be cautious when modifying environment variables that are not recommended to cha
| `INTERNAL_BACKEND_URL` | `http://localhost:8080` | no | The URL where the backend is accessible. |
| `GEOLITE_DB_PATH` | `data/GeoLite2-City.mmdb` | no | The path where the GeoLite2 database should be stored. |
| `CADDY_PORT` | `80` | no | The port on which Caddy should listen. Caddy is only active inside the Docker container. If you want to change the exposed port of the container then you sould change this variable. |
| `CADDY_DISABLED` | `false` | no | Whether Caddy should be disabled inside the Docker container. If disabled, you must configure your reverse proxy to correctly map all paths. Refer to the [official Caddyfile](https://github.com/pocket-id/pocket-id/blob/main/reverse-proxy/Caddyfile) for guidance. |
| `PORT` | `3000` | no | The port on which the frontend should listen. |
| `BACKEND_PORT` | `8080` | no | The port on which the backend should listen | |
| `BACKEND_PORT` | `8080` | no | The port on which the backend should listen |

View File

@@ -4,13 +4,17 @@ node frontend/build &
echo "Starting backend..."
cd backend && ./pocket-id-backend &
echo "Starting Caddy..."
if [ "$CADDY_DISABLED" != "true" ]; then
echo "Starting Caddy..."
# Check if TRUST_PROXY is set to true and use the appropriate Caddyfile
if [ "$TRUST_PROXY" = "true" ]; then
caddy start --adapter caddyfile --config /etc/caddy/Caddyfile.trust-proxy &
# Check if TRUST_PROXY is set to true and use the appropriate Caddyfile
if [ "$TRUST_PROXY" = "true" ]; then
caddy start --adapter caddyfile --config /etc/caddy/Caddyfile.trust-proxy &
else
caddy start --adapter caddyfile --config /etc/caddy/Caddyfile &
fi
else
caddy start --adapter caddyfile --config /etc/caddy/Caddyfile &
echo "Caddy is disabled. Skipping..."
fi
wait
wait