[discourse-web/flathub] Restore init-assets




commit d0a94082dbc468db5d134bb4ba58bc2755f19b2f
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Fri Sep 18 14:14:26 2020 +0200

    Restore init-assets

 init-assets.sh | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
---
diff --git a/init-assets.sh b/init-assets.sh
new file mode 100644
index 0000000..3d36a31
--- /dev/null
+++ b/init-assets.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+# If there are files in /tmp/configmap that are not empty
+# (overriden by a ConfigMap) copy them to /discourse/config
+if [ -n "$(ls -A /tmp/discourse-configmap)" ]
+then
+  for f in /tmp/discourse-configmap/*
+  do
+    if [ -s $f ]
+    then
+      cp /tmp/discourse-configmap/* /discourse/config/
+    fi
+  done
+fi
+
+# Replace environment variables
+# This is mandatory as at the time of doing the migration, discourse needs to know redis IP,
+# which is set thanks to discourse.conf file.
+echo "--> Overwritting env variables ..."
+envsubst < /tmp/discourse-configmap/discourse.conf > /discourse/config/discourse.conf
+echo "--> DONE"
+
+# Set environment as production
+export RAILS_ENV="production"
+
+# Always precompile assets
+exec bundle exec rake assets:precompile
\ No newline at end of file


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]