dgb-wallet/ops/blockbook-upstream.sh

22 lines
1 KiB
Bash

#!/usr/bin/env bash
# Point the live digibyte.x vhost's /blockbook/ proxy at a Blockbook
# upstream, test the config, reload nginx and prove the route works.
#
# ops/blockbook-upstream.sh atomic # Atomic Wallet's public Blockbook (no key)
# ops/blockbook-upstream.sh nownodes # NOWNodes, key from /etc/dgb-core/nownodes.env on the VPS
#
# From PowerShell use ops/blockbook-upstream.ps1 — there `bash` is the
# WSL launcher, not Git Bash, and this file would never reach the VPS.
#
# The work happens in blockbook-upstream.remote.sh, piped over
# `ssh silentmode`; the previous vhost is kept under
# /etc/angie/stale-baks/. The repo mirror
# ops/nginx-digibyte-x.conf documents the same two blocks.
set -euo pipefail
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
case "${1:-}" in
atomic) host=digibyte.atomicwallet.io; keyhdr=0 ;;
nownodes) host=dgbbook.nownodes.io; keyhdr=1 ;;
*) echo "usage: $0 atomic|nownodes" >&2; exit 2 ;;
esac
ssh silentmode "HOST=$host KEYHDR=$keyhdr bash -s" < "$here/blockbook-upstream.remote.sh"