mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-17 12:59:13 +02:00
Merge pull request #2418 from alexbelgium/codex/fix-issue-#2416-in-hassio-addons
Fix Seafile env_vars export handling https://github.com/alexbelgium/hassio-addons/issues/2416
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
|
|
||||||
|
## 12.0.18 (2026-03-20)
|
||||||
|
- Fix `env_vars` handling so extra environment variables are exported correctly.
|
||||||
|
|
||||||
## 12.0.17 (2026-03-12)
|
## 12.0.17 (2026-03-12)
|
||||||
- Ensure `SERVICE_URL` and `FILE_SERVER_ROOT` are written to the active Seafile config path.
|
- Ensure `SERVICE_URL` and `FILE_SERVER_ROOT` are written to the active Seafile config path.
|
||||||
|
|
||||||
|
|||||||
@@ -128,5 +128,5 @@ services:
|
|||||||
slug: seafile
|
slug: seafile
|
||||||
udev: true
|
udev: true
|
||||||
url: https://github.com/alexbelgium/hassio-addons/tree/master/seafile
|
url: https://github.com/alexbelgium/hassio-addons/tree/master/seafile
|
||||||
version: "12.0.17"
|
version: "12.0.18"
|
||||||
webui: http://[HOST]:[PORT:8000]
|
webui: http://[HOST]:[PORT:8000]
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ JSONSOURCE="/data/options.json"
|
|||||||
mapfile -t arr < <(jq -r 'keys[]' "${JSONSOURCE}")
|
mapfile -t arr < <(jq -r 'keys[]' "${JSONSOURCE}")
|
||||||
|
|
||||||
for KEYS in "${arr[@]}"; do
|
for KEYS in "${arr[@]}"; do
|
||||||
|
if [[ "${KEYS}" == "env_vars" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
# export key
|
# export key
|
||||||
VALUE=$(jq ."$KEYS" "${JSONSOURCE}")
|
VALUE=$(jq ."$KEYS" "${JSONSOURCE}")
|
||||||
line="${KEYS}='${VALUE//[\"\']/}'"
|
line="${KEYS}='${VALUE//[\"\']/}'"
|
||||||
@@ -33,6 +36,32 @@ for KEYS in "${arr[@]}"; do
|
|||||||
find /opt/seafile -name '*.sh' -print0 | xargs -0 sed -i "1a export $line"
|
find /opt/seafile -name '*.sh' -print0 | xargs -0 sed -i "1a export $line"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Apply extra environment variables #
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
if jq -e '.env_vars? | length > 0' "${JSONSOURCE}" >/dev/null; then
|
||||||
|
bashio::log.info "Applying env_vars"
|
||||||
|
while IFS=$'\t' read -r ENV_NAME ENV_VALUE; do
|
||||||
|
if [[ -z "${ENV_NAME}" || "${ENV_NAME}" == "null" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
if bashio::config.false "verbose" || [[ "${ENV_NAME}" == *"PASS"* ]]; then
|
||||||
|
bashio::log.blue "${ENV_NAME}=******"
|
||||||
|
else
|
||||||
|
bashio::log.blue "${ENV_NAME}=${ENV_VALUE}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export "${ENV_NAME}=${ENV_VALUE}"
|
||||||
|
|
||||||
|
ENV_VALUE_ESCAPED=$(printf "%q" "${ENV_VALUE}")
|
||||||
|
ENV_LINE="export ${ENV_NAME}=${ENV_VALUE_ESCAPED}"
|
||||||
|
sed -i "1a ${ENV_LINE}" /home/seafile/*.sh 2>/dev/null
|
||||||
|
find /opt/seafile -name '*.sh' -print0 | xargs -0 sed -i "1a ${ENV_LINE}"
|
||||||
|
done < <(jq -r '.env_vars[] | [.name, .value] | @tsv' "${JSONSOURCE}")
|
||||||
|
fi
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# DATA_LOCATION #
|
# DATA_LOCATION #
|
||||||
#################
|
#################
|
||||||
|
|||||||
Reference in New Issue
Block a user