Browse Source

Export a list of device hosts for CORS whitelist (#219)

v0.2.10
Mayank Chhabra 4 years ago
committed by GitHub
parent
commit
8b2e235792
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      docker-compose.yml
  2. 14
      scripts/start

4
docker-compose.yml

@ -97,7 +97,7 @@ services:
JWT_PRIVATE_KEY_FILE: "/jwt-private-key/jwt.key"
JWT_EXPIRATION: "3600"
DOCKER_COMPOSE_DIRECTORY: $PWD
DEVICE_HOST: ${DEVICE_HOST:-http://umbrel.local}
DEVICE_HOSTS: ${DEVICE_HOSTS:-"http://umbrel.local"}
MIDDLEWARE_API_URL: "http://10.11.2.2"
UMBREL_SEED_FILE: "/db/umbrel-seed/seed"
UMBREL_DASHBOARD_HIDDEN_SERVICE_FILE: "/var/lib/tor/web/hostname"
@ -134,7 +134,7 @@ services:
LND_NETWORK: $BITCOIN_NETWORK
LND_HOST: "10.11.1.2"
JWT_PUBLIC_KEY_FILE: "/jwt-public-key/jwt.pem"
DEVICE_HOST: ${DEVICE_HOST:-http://umbrel.local}
DEVICE_HOSTS: ${DEVICE_HOSTS:-"http://umbrel.local"}
networks:
net:
ipv4_address: 10.11.2.2

14
scripts/start

@ -49,9 +49,17 @@ echo
echo "Setting environment variables..."
echo
# Whitelist device IP, hostname and hidden service for CORS
DEVICE_IP="$(hostname -I | cut -d ' ' -f 1)"
DEVICE_HOSTNAME="$(hostname)"
export DEVICE_HOST="http://"${DEVICE_IP:-"$DEVICE_HOSTNAME".local}""
DEVICE_HOSTS="http://${DEVICE_IP},http://${DEVICE_HOSTNAME}.local,https://${DEVICE_HOSTNAME}.local,http://${DEVICE_HOSTNAME},https://${DEVICE_HOSTNAME}"
if [[ -f "${UMBREL_ROOT}/tor/data/web/hostname" ]]; then
hidden_service_url=$(cat "${UMBREL_ROOT}/tor/data/web/hostname")
DEVICE_HOSTS="${DEVICE_HOSTS},http://${hidden_service_url}"
fi
export DEVICE_HOSTS=$DEVICE_HOSTS
# Increase default Docker and Compose timeouts to 240s
# as bitcoin can take a long while to respond
export DOCKER_CLIENT_TIMEOUT=240
@ -78,4 +86,6 @@ docker-compose up --detach --build --remove-orphans
echo
echo "Umbrel is now accessible at"
echo " $DEVICE_HOST"
echo " http://${DEVICE_HOSTNAME}.local"
echo " http://${DEVICE_IP}"
[[ ! -z "${hidden_service_url:-}" ]] && echo " http://${hidden_service_url}"
Loading…
Cancel
Save