Ensure we have the new required active record secrets

This commit is contained in:
Johannes Zellner 2024-10-10 10:29:03 +02:00
parent fdda17dc83
commit 8a34a7093e

View file

@ -47,6 +47,17 @@ fi
rm -f /run/mastodon/Gemfile.lock && cp /app/code/Gemfile.lock.original /run/mastodon/Gemfile.lock rm -f /run/mastodon/Gemfile.lock && cp /app/code/Gemfile.lock.original /run/mastodon/Gemfile.lock
# generate new secrets
if ! grep "ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY" /app/data/env.production; then
echo "ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=$(openssl rand -hex 16)" >> /app/data/env.production
fi
if ! grep "ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT" /app/data/env.production; then
echo "ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=$(openssl rand -hex 16)" >> /app/data/env.production
fi
if ! grep "ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY" /app/data/env.production; then
echo "ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY=$(openssl rand -hex 16)" >> /app/data/env.production
fi
if grep -q "^SECRET_KEY_BASE=$" /app/data/env.production; then if grep -q "^SECRET_KEY_BASE=$" /app/data/env.production; then
echo "==> Generating secrets" echo "==> Generating secrets"
export RANDFILE=/tmp/.rnd export RANDFILE=/tmp/.rnd