34 lines
1.4 KiB
Bash
34 lines
1.4 KiB
Bash
#!/bin/sh
|
|
|
|
CONFIG_PATH=/data/options.json
|
|
|
|
# --- Mapping HA Options to MeshMonitor Env Vars ---
|
|
export MESHTASTIC_NODE_IP=$(jq --raw-output '.meshtastic_node_ip' $CONFIG_PATH)
|
|
export MESHTASTIC_TCP_PORT=$(jq --raw-output '.meshtastic_tcp_port // 4403' $CONFIG_PATH)
|
|
export ADMIN_PASSWORD=$(jq --raw-output '.admin_password // "changeme"' $CONFIG_PATH)
|
|
export SESSION_SECRET=$(jq --raw-output '.session_secret // "default_secret"' $CONFIG_PATH)
|
|
export DISABLE_ANONYMOUS=$(jq --raw-output '.disable_anonymous // true' $CONFIG_PATH)
|
|
export DEBUG_LEVEL=$(jq --raw-output '.debug_level // "info"' $CONFIG_PATH)
|
|
|
|
# --- Fixed Add-on Environment Settings ---
|
|
export PORT=3001
|
|
export NODE_ENV=production
|
|
export DATABASE_PATH="/data/meshmonitor.db"
|
|
export TRUST_PROXY=true
|
|
export ALLOWED_ORIGINS="*"
|
|
export COOKIE_SECURE=false
|
|
export BASE_URL="./"
|
|
|
|
# --- Ingress Path Resolution Patch ---
|
|
# This ensures that the frontend assets (JS/CSS) are requested relative
|
|
# to the Home Assistant Ingress sub-path instead of the root IP.
|
|
echo "Applying Ingress path patches..."
|
|
find /app/dist/client -type f -name "*.html" -exec sed -i 's/src="\//src=".\//g' {} +
|
|
find /app/dist/client -type f -name "*.html" -exec sed -i 's/href="\//href=".\//g' {} +
|
|
find /app/dist/client -type f -name "*.js" -exec sed -i 's/\"\/assets\//\".\/assets\//g' {} +
|
|
|
|
echo "Starting MeshMonitor on port $PORT..."
|
|
echo "Database located at $DATABASE_PATH"
|
|
|
|
cd /app
|
|
exec node dist/server/server.js |