Skip to content

Commit 07958d1

Browse files
committed
Allow optional whitespace when scraping "secure" configuration values to test whether they're already set
1 parent 3cfcc9c commit 07958d1

10 files changed

+10
-10
lines changed

docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ EOPHP
217217
set_config "$unique" "${!uniqVar}"
218218
else
219219
# if not specified, let's generate a random value
220-
currentVal="$(sed -rn -e "s/define\((([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\);/\4/p" wp-config.php)"
220+
currentVal="$(sed -rn -e "s/define\(\s*(([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\s*\);/\4/p" wp-config.php)"
221221
if [ "$currentVal" = 'put your unique phrase here' ]; then
222222
set_config "$unique" "$(head -c1m /dev/urandom | sha1sum | cut -d' ' -f1)"
223223
fi

php7.1/apache/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ EOPHP
217217
set_config "$unique" "${!uniqVar}"
218218
else
219219
# if not specified, let's generate a random value
220-
currentVal="$(sed -rn -e "s/define\((([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\);/\4/p" wp-config.php)"
220+
currentVal="$(sed -rn -e "s/define\(\s*(([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\s*\);/\4/p" wp-config.php)"
221221
if [ "$currentVal" = 'put your unique phrase here' ]; then
222222
set_config "$unique" "$(head -c1m /dev/urandom | sha1sum | cut -d' ' -f1)"
223223
fi

php7.1/fpm-alpine/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ EOPHP
217217
set_config "$unique" "${!uniqVar}"
218218
else
219219
# if not specified, let's generate a random value
220-
currentVal="$(sed -rn -e "s/define\((([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\);/\4/p" wp-config.php)"
220+
currentVal="$(sed -rn -e "s/define\(\s*(([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\s*\);/\4/p" wp-config.php)"
221221
if [ "$currentVal" = 'put your unique phrase here' ]; then
222222
set_config "$unique" "$(head -c1m /dev/urandom | sha1sum | cut -d' ' -f1)"
223223
fi

php7.1/fpm/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ EOPHP
217217
set_config "$unique" "${!uniqVar}"
218218
else
219219
# if not specified, let's generate a random value
220-
currentVal="$(sed -rn -e "s/define\((([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\);/\4/p" wp-config.php)"
220+
currentVal="$(sed -rn -e "s/define\(\s*(([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\s*\);/\4/p" wp-config.php)"
221221
if [ "$currentVal" = 'put your unique phrase here' ]; then
222222
set_config "$unique" "$(head -c1m /dev/urandom | sha1sum | cut -d' ' -f1)"
223223
fi

php7.2/apache/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ EOPHP
217217
set_config "$unique" "${!uniqVar}"
218218
else
219219
# if not specified, let's generate a random value
220-
currentVal="$(sed -rn -e "s/define\((([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\);/\4/p" wp-config.php)"
220+
currentVal="$(sed -rn -e "s/define\(\s*(([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\s*\);/\4/p" wp-config.php)"
221221
if [ "$currentVal" = 'put your unique phrase here' ]; then
222222
set_config "$unique" "$(head -c1m /dev/urandom | sha1sum | cut -d' ' -f1)"
223223
fi

php7.2/fpm-alpine/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ EOPHP
217217
set_config "$unique" "${!uniqVar}"
218218
else
219219
# if not specified, let's generate a random value
220-
currentVal="$(sed -rn -e "s/define\((([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\);/\4/p" wp-config.php)"
220+
currentVal="$(sed -rn -e "s/define\(\s*(([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\s*\);/\4/p" wp-config.php)"
221221
if [ "$currentVal" = 'put your unique phrase here' ]; then
222222
set_config "$unique" "$(head -c1m /dev/urandom | sha1sum | cut -d' ' -f1)"
223223
fi

php7.2/fpm/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ EOPHP
217217
set_config "$unique" "${!uniqVar}"
218218
else
219219
# if not specified, let's generate a random value
220-
currentVal="$(sed -rn -e "s/define\((([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\);/\4/p" wp-config.php)"
220+
currentVal="$(sed -rn -e "s/define\(\s*(([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\s*\);/\4/p" wp-config.php)"
221221
if [ "$currentVal" = 'put your unique phrase here' ]; then
222222
set_config "$unique" "$(head -c1m /dev/urandom | sha1sum | cut -d' ' -f1)"
223223
fi

php7.3/apache/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ EOPHP
217217
set_config "$unique" "${!uniqVar}"
218218
else
219219
# if not specified, let's generate a random value
220-
currentVal="$(sed -rn -e "s/define\((([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\);/\4/p" wp-config.php)"
220+
currentVal="$(sed -rn -e "s/define\(\s*(([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\s*\);/\4/p" wp-config.php)"
221221
if [ "$currentVal" = 'put your unique phrase here' ]; then
222222
set_config "$unique" "$(head -c1m /dev/urandom | sha1sum | cut -d' ' -f1)"
223223
fi

php7.3/fpm-alpine/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ EOPHP
217217
set_config "$unique" "${!uniqVar}"
218218
else
219219
# if not specified, let's generate a random value
220-
currentVal="$(sed -rn -e "s/define\((([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\);/\4/p" wp-config.php)"
220+
currentVal="$(sed -rn -e "s/define\(\s*(([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\s*\);/\4/p" wp-config.php)"
221221
if [ "$currentVal" = 'put your unique phrase here' ]; then
222222
set_config "$unique" "$(head -c1m /dev/urandom | sha1sum | cut -d' ' -f1)"
223223
fi

php7.3/fpm/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ EOPHP
217217
set_config "$unique" "${!uniqVar}"
218218
else
219219
# if not specified, let's generate a random value
220-
currentVal="$(sed -rn -e "s/define\((([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\);/\4/p" wp-config.php)"
220+
currentVal="$(sed -rn -e "s/define\(\s*(([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\s*\);/\4/p" wp-config.php)"
221221
if [ "$currentVal" = 'put your unique phrase here' ]; then
222222
set_config "$unique" "$(head -c1m /dev/urandom | sha1sum | cut -d' ' -f1)"
223223
fi

0 commit comments

Comments
 (0)