Prevent wrong config files for caddy on container restarts

This commit is contained in:
Finn Stutzenstein 2021-05-27 10:19:22 +02:00
parent 3eb7386a58
commit 899257791d
No known key found for this signature in database
GPG Key ID: 9042F605C6324654

View File

@ -18,7 +18,7 @@ fi
# config: https # config: https
if [[ -n "$EXTERNAL_HTTPS_PORT" ]] ; then if [[ -n "$EXTERNAL_HTTPS_PORT" ]] ; then
cat <<EOF >> /etc/caddy/endpoint cat <<EOF > /etc/caddy/endpoint
https://:8001 { https://:8001 {
tls /certs/cert.pem /certs/key.pem tls /certs/cert.pem /certs/key.pem
EOF EOF
@ -33,7 +33,7 @@ fi
# config: https and additionally http -> create redirect-file # config: https and additionally http -> create redirect-file
if [[ -n "$EXTERNAL_HTTP_PORT" ]] && [[ -n "$EXTERNAL_HTTPS_PORT" ]] ; then if [[ -n "$EXTERNAL_HTTP_PORT" ]] && [[ -n "$EXTERNAL_HTTPS_PORT" ]] ; then
cat <<EOF >> /etc/caddy/redirect cat <<EOF > /etc/caddy/redirect
http://:8000 { http://:8000 {
redir https://$INSTANCE_DOMAIN{uri} redir https://$INSTANCE_DOMAIN{uri}
} }
@ -56,7 +56,7 @@ fi
# close # close
# } # }
if [[ ! -z "$ALLOWED_HOSTS" ]]; then if [[ ! -z "$ALLOWED_HOSTS" ]]; then
cat <<EOF >> /etc/caddy/invalid_host cat <<EOF > /etc/caddy/invalid_host
@invalid-host { @invalid-host {
not { not {
EOF EOF