summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorthrowaway <developerthrowaway@protonmail.com>2023-09-22 16:20:39 -0500
committerlolcat <lolcat@no-reply@lolcat.ca>2023-09-22 16:20:39 -0500
commitb7cc53c156867ea3d0351737d9815d506b61db09 (patch)
tree44b43ff677cd10eb9bc2f181cf38f71f12c4c86e /docker
parentbe8546bdf55f9c77012217ec510b81d9d5fd58b3 (diff)
allow docker container to run without ssl certificates (#14)
if certificate files are not mounted to /etc/4get/certs then remove ssl virtual host in /etc/apache2/httpd.conf and listen on port 80 also change references "luuul/4get:1.0.0" to "luuul/4get:latest" Reviewed-on: https://git.lolcat.ca/lolcat/4get/pulls/14 Co-authored-by: throwaway <developerthrowaway@protonmail.com> Co-committed-by: throwaway <developerthrowaway@protonmail.com>
Diffstat (limited to 'docker')
-rwxr-xr-xdocker/docker-entrypoint.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh
index 939e59b..89bd7cf 100755
--- a/docker/docker-entrypoint.sh
+++ b/docker/docker-entrypoint.sh
@@ -2,4 +2,18 @@
set -e
sed -i "s/ServerName.*/ServerName ${FOURGET_SERVER_NAME}/g" /etc/apache2/httpd.conf
sed -i "s/ServerAdmin.*/ServerAdmin ${FOURGET_SERVER_ADMIN_EMAIL}/g" /etc/apache2/httpd.conf
+
+if [ ! -f /etc/4get/certs/cert.pem ] || [ ! -f /etc/4get/certs/chain.pem ] || [ ! -f /etc/4get/certs/privkey.pem ]; then
+ # remove SSL VirtualHost
+ echo "No certificate files detected. Listening on port 80"
+ sed -i '/<VirtualHost \*:443>/,/<\/VirtualHost>/d' /etc/apache2/httpd.conf
+
+ # prepend Listen 80 to /apache2/httpd.conf
+ echo "Listen 80" > /etc/apache2/httpd.conf_temp
+ cat /etc/apache2/httpd.conf >> /etc/apache2/httpd.conf_temp
+ mv /etc/apache2/httpd.conf_temp /etc/apache2/httpd.conf
+fi
+
+echo "4get is running"
exec httpd -DFOREGROUND
+