2019-03-23 13:12:58 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ "$REPLACE_ENV_VARIABLES" = "TRUE" ]; then
|
|
|
|
echo "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
|
2019-03-25 17:10:45 +00:00
|
|
|
if [[ "$name" = $ENV_VARIABLE_PREFIX* ]] && [[ $value =~ ^[0-9a-zA-Z_:/=?.+\-]*$ ]] && [[ $name =~ ^[0-9a-zA-Z_\-]*$ ]]; then
|
2019-03-29 11:11:42 +00:00
|
|
|
echo "Replacing $name with $value ..."
|
|
|
|
find /data/ -type f \( -name "*.yml" -or -name "*.yaml" -or -name "*.txt" -or -name "*.cfg" -or -name "*.properties" \) -exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \;
|
2019-03-23 13:12:58 +00:00
|
|
|
fi
|
|
|
|
done < <(env)
|
|
|
|
fi
|
|
|
|
|
|
|
|
exec /start-minecraftFinalSetup $@
|