fix(minecraft-server): env variable value check not working

The check for the value of the env variable now works correctly.

#298
This commit is contained in:
Michael Reichenbach 2019-03-25 18:10:45 +01:00
parent 67cf80d70f
commit 73046d7499

View File

@ -5,7 +5,7 @@ if [ "$REPLACE_ENV_VARIABLES" = "TRUE" ]; then
while IFS='=' read -r name value ; do while IFS='=' read -r name value ; do
# check if name of env variable matches the prefix # check if name of env variable matches the prefix
# sanity check environment variables to avoid code injections # sanity check environment variables to avoid code injections
if [[ "$name" = $ENV_VARIABLE_PREFIX* ]] && [[ $value =~ ^[0-9a-zA-Z_\-:/=?.+]*$ ]] && [[ $name =~ ^[0-9a-zA-Z_\-]*$ ]]; then if [[ "$name" = $ENV_VARIABLE_PREFIX* ]] && [[ $value =~ ^[0-9a-zA-Z_:/=?.+\-]*$ ]] && [[ $name =~ ^[0-9a-zA-Z_\-]*$ ]]; then
echo "$name = $value" echo "$name = $value"
find /data/ -type f -exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \; find /data/ -type f -exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \;
fi fi