Files
bamboo-ha/bamboo/run.sh
T

33 lines
1.1 KiB
Bash

#!/usr/bin/with-contenv bashio
# Starts Bamboo with the address and token from the add-on's configuration.
set -e
url="$(bashio::config 'hammerhead_url')"
token="$(bashio::config 'token')"
if [ -z "${url}" ] || [ -z "${token}" ]; then
bashio::log.fatal "Set the Hammerhead address and the site token in this add-on's Configuration tab, then start it again."
bashio::exit.nok
fi
# Settings go in through the environment so the token does not show up in the process list.
export BAMBOO_HAMMERHEAD="${url%/}"
export BAMBOO_TOKEN="${token}"
# Service discovery is opt-in: Bamboo reports what it finds as suggested targets in Hammerhead.
if bashio::config.true 'discover'; then
export BAMBOO_DISCOVER=1
fi
subnets="$(bashio::config 'discover_subnets')"
if [ -n "${subnets}" ]; then
export BAMBOO_DISCOVER_SUBNETS="${subnets}"
fi
ports="$(bashio::config 'discover_ports')"
if [ -n "${ports}" ]; then
export BAMBOO_DISCOVER_PORTS="${ports}"
fi
bashio::log.info "Starting $(bamboo -version), connecting to ${BAMBOO_HAMMERHEAD}"
# /data survives restarts and updates; it holds this site's WireGuard key.
exec bamboo -data /data