Files
dont-stop-folding/root/etc/s6-overlay/s6-rc.d/svc-foldingathome/run

47 lines
1.1 KiB
Plaintext
Executable File

#!/usr/bin/with-contenv bash
# shellcheck shell=bash
declare -a args
# Network: bind to all interfaces, allow all connections
args+=(--http-addresses "0.0.0.0:7396")
args+=(--allow "0/0")
# FAH account credentials
if [[ -n "${FAH_USER}" ]]; then
args+=(--user "${FAH_USER}")
fi
if [[ -n "${TEAM}" ]]; then
args+=(--team "${TEAM}")
fi
if [[ -n "${PASSKEY}" ]]; then
args+=(--passkey "${PASSKEY}")
fi
# Power level (light, medium, full)
if [[ -n "${POWER}" ]]; then
args+=(--power "${POWER}")
fi
# Online account token (new FAH 8 account system)
if [[ -n "${ACCOUNT_TOKEN}" ]]; then
args+=(--account-token "${ACCOUNT_TOKEN}")
if [[ -n "${MACHINE_NAME}" ]]; then
args+=(--machine-name "${MACHINE_NAME}")
fi
fi
if [[ -z "${FAH_USER}" ]] && [[ -z "${ACCOUNT_TOKEN}" ]]; then
echo "INFO: No FAH_USER or ACCOUNT_TOKEN set — folding anonymously."
fi
# Run from /config so fah-client stores its data there
mkdir -p /config
cd /config || exit 1
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 7396" \
/app/fah-client "${args[@]}" ${CLI_ARGS}