Make secret key generation idempotent (#390)
Only generate secret key if not set
This commit is contained in:
parent
9dfc5c99de
commit
3e0ca482c2
@ -90,6 +90,7 @@ ensure_file_from_example $SENTRY_CONFIG_PY
|
|||||||
ensure_file_from_example $SENTRY_CONFIG_YML
|
ensure_file_from_example $SENTRY_CONFIG_YML
|
||||||
ensure_file_from_example $SENTRY_EXTRA_REQUIREMENTS
|
ensure_file_from_example $SENTRY_EXTRA_REQUIREMENTS
|
||||||
|
|
||||||
|
if grep -xq "system.secret-key: '!!changeme!!'" $SENTRY_CONFIG_YML ; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "Generating secret key..."
|
echo "Generating secret key..."
|
||||||
# This is to escape the secret key to be used in sed below
|
# This is to escape the secret key to be used in sed below
|
||||||
@ -98,6 +99,7 @@ echo "Generating secret key..."
|
|||||||
SECRET_KEY=$(export LC_ALL=C; head /dev/urandom | tr -dc "a-z0-9@#%^&*(-_=+)" | head -c 50 | sed -e 's/[\/&]/\\&/g')
|
SECRET_KEY=$(export LC_ALL=C; head /dev/urandom | tr -dc "a-z0-9@#%^&*(-_=+)" | head -c 50 | sed -e 's/[\/&]/\\&/g')
|
||||||
sed -i -e 's/^system.secret-key:.*$/system.secret-key: '"'$SECRET_KEY'"'/' $SENTRY_CONFIG_YML
|
sed -i -e 's/^system.secret-key:.*$/system.secret-key: '"'$SECRET_KEY'"'/' $SENTRY_CONFIG_YML
|
||||||
echo "Secret key written to $SENTRY_CONFIG_YML"
|
echo "Secret key written to $SENTRY_CONFIG_YML"
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Building and tagging Docker images..."
|
echo "Building and tagging Docker images..."
|
||||||
|
Reference in New Issue
Block a user