- Introduced a new `host` option in `flake.nix` to specify the server's bind address, defaulting to `0.0.0.0`. - Updated `run.sh` to use the `HOST` environment variable for server binding. - Modified `config.py` to read the `HOST` from environment variables, defaulting to `0.0.0.0`. - Enhanced `README.md` with instructions for setting up the `HOST` variable and clarified access details for development and production modes. - Adjusted `vite.config.ts` to allow frontend access from other computers by default.
37 lines
1.0 KiB
Bash
Executable File
37 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
# Default values
|
|
export PORT=${PORT:-8080}
|
|
export HOST=${HOST:-0.0.0.0} # Bind to all interfaces by default
|
|
export POSTGRES_SOCKET_PATH=${POSTGRES_SOCKET_PATH:-/run/postgresql}
|
|
export POSTGRES_DB=${POSTGRES_DB:-jawz}
|
|
|
|
# Read secrets from files if _FILE variables are set (for sops-nix integration)
|
|
if [ -n "$SONARR_API_KEY_FILE" ] && [ -f "$SONARR_API_KEY_FILE" ]; then
|
|
export SONARR_API_KEY=$(cat "$SONARR_API_KEY_FILE")
|
|
fi
|
|
|
|
if [ -n "$RADARR_API_KEY_FILE" ] && [ -f "$RADARR_API_KEY_FILE" ]; then
|
|
export RADARR_API_KEY=$(cat "$RADARR_API_KEY_FILE")
|
|
fi
|
|
|
|
if [ -n "$LIDARR_API_KEY_FILE" ] && [ -f "$LIDARR_API_KEY_FILE" ]; then
|
|
export LIDARR_API_KEY=$(cat "$LIDARR_API_KEY_FILE")
|
|
fi
|
|
|
|
if [ -n "$MOVIEMAP_ADMIN_TOKEN_FILE" ] && [ -f "$MOVIEMAP_ADMIN_TOKEN_FILE" ]; then
|
|
export MOVIEMAP_ADMIN_TOKEN=$(cat "$MOVIEMAP_ADMIN_TOKEN_FILE")
|
|
fi
|
|
|
|
# Run migrations if needed
|
|
if [ -d "alembic/versions" ]; then
|
|
alembic upgrade head
|
|
fi
|
|
|
|
# Start the server
|
|
exec uvicorn main:app --host "$HOST" --port "$PORT"
|
|
|