From 7d759428ca1d491ac91865bb7b8db0b6ee42a14a Mon Sep 17 00:00:00 2001
From: Nigel Kukard <nkukard@lbsd.net>
Date: Mon, 21 Oct 2024 11:21:07 +0000
Subject: [PATCH] fix: move output of keys when upgrading

---
 .../flexible-docker-containers/init.d/42-mastodon.sh      | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/usr/local/share/flexible-docker-containers/init.d/42-mastodon.sh b/usr/local/share/flexible-docker-containers/init.d/42-mastodon.sh
index 69a0e28..929a8f9 100755
--- a/usr/local/share/flexible-docker-containers/init.d/42-mastodon.sh
+++ b/usr/local/share/flexible-docker-containers/init.d/42-mastodon.sh
@@ -219,6 +219,10 @@ if [ "$MASTODON_MODE" = "web" ]; then
 		sleep 2
 	done
 
+	# Output keys if we don't have any
+	if [ -z "$ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY" ]; then
+		mastodon-rails db:encryption:init
+	fi
 
 	# Check if we need to initialize the database
 	if [ ! -f /opt/mastodon/private/VERSION ]; then
@@ -247,10 +251,6 @@ if [ "$MASTODON_MODE" = "web" ]; then
 		fi
 	fi
 
-	# Output keys if we don't have any
-	if [ -z "$ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY" ]; then
-		mastodon-rails db:encryption:init
-	fi
 else
 
 	while ! nc -z "$MASTODON_HOST" 3000; do
-- 
GitLab