Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ done
log "Starting felddy/foundryvtt container v${image_version}"
log_debug "CONTAINER_VERBOSE set. Debug logging enabled."
log_debug "Running as: $(id)"
log_debug "Environment:\n$(env | sort | sed -E 's/(.*PASSWORD|KEY.*)=.*/\1=[REDACTED]/g')"
log_debug "Environment:\n$(env | sort | sed -E 's/([^=]*(PASSWORD|KEY|SECRET|TOKEN|SALT)[^=]*)=.*/\1=[REDACTED]/g')"
log_debug "Data directory: ${DATA_DIR}"

# Show the mount details for the data directory
Expand Down
13 changes: 7 additions & 6 deletions src/launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,22 @@ fi
# Space separated list of regex rules which environment variables must meet to
# be carried over to the new environment, which Node/Foundry will be running in.
ENV_VAR_PASSLIST_REGEX='^HOME$ ^NODE_.+$ ^TZ$ .+_(PROXY|proxy)$'
# Build list of environment variables to carry over into a clean environment
ENV_VAR_CARRY_LIST=''
# Build list of environment variables to carry over into a clean environment.
# An array keeps values containing spaces (e.g. NODE_OPTIONS="--a --b") as
# single NAME=VALUE arguments to env.
ENV_VAR_CARRY=()
# shellcheck disable=SC3045
# busybox read supports the -rd option
while IFS='=' read -rd '' ENV_VAR_NAME ENV_VAR_VALUE; do
for VAR_REGEX in $ENV_VAR_PASSLIST_REGEX; do
if [[ $ENV_VAR_NAME =~ ${VAR_REGEX} ]]; then
ENV_VAR_CARRY_LIST="${ENV_VAR_CARRY_LIST} ${ENV_VAR_NAME}=${ENV_VAR_VALUE}"
ENV_VAR_CARRY+=("${ENV_VAR_NAME}=${ENV_VAR_VALUE}")
break
fi
done
done < <(env -0)

# Exec node with clean environment to prevent credential leaks
log "Starting Foundry Virtual Tabletop."
# We want ENV_VAR_CARRY_LIST to word split
# shellcheck disable=SC2086
exec env -i $ENV_VAR_CARRY_LIST /usr/local/bin/node "$@" || log_error "Exec failed with code $?"
# ${arr[@]+...} guards the empty-array case under `set -o nounset` on bash <4.4
exec env -i ${ENV_VAR_CARRY[@]+"${ENV_VAR_CARRY[@]}"} /usr/local/bin/node "$@" || log_error "Exec failed with code $?"