fix: read add-on options via bashio instead of broken env substitution
This commit is contained in:
@@ -20,13 +20,6 @@ options:
|
||||
power: "medium"
|
||||
account_token: ""
|
||||
machine_name: ""
|
||||
environment:
|
||||
FAH_USER: "{user}"
|
||||
TEAM: "{team}"
|
||||
PASSKEY: "{passkey}"
|
||||
POWER: "{power}"
|
||||
ACCOUNT_TOKEN: "{account_token}"
|
||||
MACHINE_NAME: "{machine_name}"
|
||||
schema:
|
||||
user: str?
|
||||
team: str
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
|
||||
declare -a args
|
||||
@@ -8,37 +8,40 @@ args+=(--http-addresses "0.0.0.0:7396")
|
||||
args+=(--allow "0/0")
|
||||
|
||||
# FAH account credentials
|
||||
if [[ -n "${FAH_USER}" ]]; then
|
||||
FAH_USER=$(bashio::config 'user')
|
||||
TEAM=$(bashio::config 'team')
|
||||
PASSKEY=$(bashio::config 'passkey')
|
||||
POWER=$(bashio::config 'power')
|
||||
ACCOUNT_TOKEN=$(bashio::config 'account_token')
|
||||
MACHINE_NAME=$(bashio::config 'machine_name')
|
||||
|
||||
if bashio::config.has_value 'user'; then
|
||||
args+=(--user "${FAH_USER}")
|
||||
fi
|
||||
|
||||
if [[ -n "${TEAM}" ]]; then
|
||||
if bashio::config.has_value 'team'; then
|
||||
args+=(--team "${TEAM}")
|
||||
fi
|
||||
|
||||
if [[ -n "${PASSKEY}" ]]; then
|
||||
if bashio::config.has_value '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
|
||||
if bashio::config.has_value 'account_token'; then
|
||||
args+=(--account-token "${ACCOUNT_TOKEN}")
|
||||
if [[ -n "${MACHINE_NAME}" ]]; then
|
||||
if bashio::config.has_value '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."
|
||||
if ! bashio::config.has_value 'user' && ! bashio::config.has_value 'account_token'; then
|
||||
bashio::log.info "No 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 /app/fah-client "${args[@]}" ${CLI_ARGS}
|
||||
exec /app/fah-client "${args[@]}"
|
||||
|
||||
Reference in New Issue
Block a user