From b9cdae9857b2609e7fbb0c61c16f25473c510f7d Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Mon, 6 Apr 2020 11:46:59 +0200 Subject: [PATCH] Spec out a conditional TLS inclusion patch --- sbin/entrypoint.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/sbin/entrypoint.sh b/sbin/entrypoint.sh index 6729a14..4c3f367 100755 --- a/sbin/entrypoint.sh +++ b/sbin/entrypoint.sh @@ -6,12 +6,19 @@ set -eu -o pipefail run_jekyll() { set -eu - jekyll serve \ - --port "$JEKYLL_PORT" \ - --host "$JEKYLL_HOST" \ - --ssl-cert "$JEKYLL_SSL_CERT" \ - --ssl-key "$JEKYLL_SSL_KEY" \ - --trace + local args="--port $JEKYLL_PORT --host $JEKYLL_HOST --trace" + + # Note(decentral1se): handle the case where the Dokku is deploying the app + # with HTTP support only before we have a chance to deploy the lets encrypt + # certificates and mount them into the container + if [ -f "$JEKYLL_SSL_CERT" ]; then + args="${args} --ssl-cert $JEKYLL_SSL_CERT" + fi + if [ -f "$JEKYLL_SSL_KEY" ]; then + args="${args} --ssl-key $JEKYLL_SSL_KEY" + fi + + jekyll serve "$args" } # Main entrypoint