From d3fe8fac40ebd5db0553de95ae356b1995046b0a Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 30 Jan 2020 00:36:06 +0100
Subject: [PATCH] Add Pleroma config customization.

---
 buster/other_files/append_pleroma_config | 3 +++
 buster/setup_scripts/setup_pleroma.sh    | 5 +++++
 2 files changed, 8 insertions(+)
 create mode 100644 buster/other_files/append_pleroma_config

diff --git a/buster/other_files/append_pleroma_config b/buster/other_files/append_pleroma_config
new file mode 100644
index 0000000..6ee31af
--- /dev/null
+++ b/buster/other_files/append_pleroma_config
@@ -0,0 +1,3 @@
+
+config :pleroma, :instance,
+  registrations_open: false
diff --git a/buster/setup_scripts/setup_pleroma.sh b/buster/setup_scripts/setup_pleroma.sh
index 22e318e..cb7725a 100755
--- a/buster/setup_scripts/setup_pleroma.sh
+++ b/buster/setup_scripts/setup_pleroma.sh
@@ -58,6 +58,11 @@ su pleroma -s $SHELL -lc "./bin/pleroma_ctl instance gen \
 su postgres -s $SHELL -lc "psql -f /tmp/setup_db.psql"
 su pleroma -s $SHELL -lc "./bin/pleroma_ctl migrate"
 
+# Since the OTP release does not support .secret.exs configuration
+# files, we hack our own alternative by simply appending custom
+# configurations to /etc/config.exs.
+cat "${config_tree_prefix}/other_files/append_pleroma_config" >> /etc/config.exs
+
 # Prepare NGINX config for Pleroma.
 cp /opt/pleroma/installation/pleroma.nginx /etc/nginx/sites-available/pleroma.nginx
 sed -i "s/example\.tld/${domain}/g" /etc/nginx/sites-available/pleroma.nginx
-- 
2.30.2