Files
addons/meshmonitor/run.sh
2026-03-22 15:25:05 +01:00

25 lines
953 B
Bash

#!/bin/bash
CONFIG_PATH=/data/options.json
export MESHTASTIC_NODE_IP=$(jq --raw-output '.MESHTASTIC_NODE_IP' $CONFIG_PATH)
export MESHTASTIC_TCP_PORT=$(jq --raw-output '.MESHTASTIC_TCP_PORT' $CONFIG_PATH)
export SESSION_SECRET=$(jq --raw-output '.SESSION_SECRET' $CONFIG_PATH)
export DISABLE_ANONYMOUS=$(jq --raw-output '.DISABLE_ANONYMOUS' $CONFIG_PATH)
export DATABASE_PATH="/data/meshmonitor.db"
export PORT=3001
# Ingress/Iframe requirements
export TRUST_PROXY=true
export ALLOWED_ORIGINS="*"
export COOKIE_SAMESITE="none"
export COOKIE_SECURE=true
# Fetch the dynamic Home Assistant Ingress URL so assets load properly
if [ -n "$SUPERVISOR_TOKEN" ]; then
export BASE_URL=$(curl -s -H "Authorization: Bearer ${SUPERVISOR_TOKEN}" http://supervisor/addons/self/info | jq --raw-output '.data.ingress_url')
echo "Ingress BASE_URL set to: $BASE_URL"
fi
echo "Starting MeshMonitor for node: $MESHTASTIC_NODE_IP..."
exec node dist/server/server.js