mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-11-10 14:24:28 +00:00
22 lines
816 B
Bash
22 lines
816 B
Bash
#!/bin/bash
|
|
|
|
. /start-utils
|
|
|
|
if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then
|
|
log "Replacing env variables in configs that match the prefix $ENV_VARIABLE_PREFIX..."
|
|
while IFS='=' read -r name value ; do
|
|
# check if name of env variable matches the prefix
|
|
# sanity check environment variables to avoid code injections
|
|
if [[ "$name" = $ENV_VARIABLE_PREFIX* ]] \
|
|
&& [[ $value =~ ^[0-9a-zA-Z_:/=?.+\-]*$ ]] \
|
|
&& [[ $name =~ ^[0-9a-zA-Z_\-]*$ ]]; then
|
|
log "Replacing $name with $value ..."
|
|
find /data/ -type f \
|
|
\( -name "*.yml" -or -name "*.yaml" -or -name "*.txt" -or -name "*.cfg" \
|
|
-or -name "*.conf" -or -name "*.properties" \) \
|
|
-exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \;
|
|
fi
|
|
done < <(env)
|
|
fi
|
|
|
|
exec /start-minecraftFinalSetup $@
|