mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-19 11:45:10 +08:00
fix(entrypoint): Preserve $ in passwords during template expansion (#12509)
### What problem does this PR solve? Fix shell variable expansion to preserve $ in password defaults when env vars are unset. Fixes Azure RDS auto-rotated passwords (that contain $) being truncated during template processing. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -156,8 +156,20 @@ TEMPLATE_FILE="${CONF_DIR}/service_conf.yaml.template"
|
|||||||
CONF_FILE="${CONF_DIR}/service_conf.yaml"
|
CONF_FILE="${CONF_DIR}/service_conf.yaml"
|
||||||
|
|
||||||
rm -f "${CONF_FILE}"
|
rm -f "${CONF_FILE}"
|
||||||
|
DEF_ENV_VALUE_PATTERN="\$\{([^:]+):-([^}]+)\}"
|
||||||
while IFS= read -r line || [[ -n "$line" ]]; do
|
while IFS= read -r line || [[ -n "$line" ]]; do
|
||||||
|
if [[ "$line" =~ DEF_ENV_VALUE_PATTERN ]]; then
|
||||||
|
varname="${BASH_REMATCH[1]}"
|
||||||
|
default="${BASH_REMATCH[2]}"
|
||||||
|
|
||||||
|
if [ -n "${!varname}" ]; then
|
||||||
|
eval "echo \"$line"\" >> "${CONF_FILE}"
|
||||||
|
else
|
||||||
|
echo "$line" | sed -E "s/\\\$\{[^:]+:-([^}]+)\}/\1/g" >> "${CONF_FILE}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
eval "echo \"$line\"" >> "${CONF_FILE}"
|
eval "echo \"$line\"" >> "${CONF_FILE}"
|
||||||
|
fi
|
||||||
done < "${TEMPLATE_FILE}"
|
done < "${TEMPLATE_FILE}"
|
||||||
|
|
||||||
export LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/"
|
export LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/"
|
||||||
|
|||||||
Reference in New Issue
Block a user