aurweb/docker/nginx-entrypoint.sh
Kevin Morris b98159d5b9
change(docker): use step-ca for CA + cert generation
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-27 16:43:29 -08:00

24 lines
638 B
Bash
Executable file

#!/bin/bash
set -eou pipefail
# If production.{cert,key}.pem exists, prefer them. This allows
# user customization of the certificates that FastAPI uses.
# Otherwise, fallback to localhost.{cert,key}.pem, generated by `ca`.
CERT=/data/production.cert.pem
KEY=/data/production.key.pem
DEST_CERT=/etc/ssl/certs/web.cert.pem
DEST_KEY=/etc/ssl/private/web.key.pem
if [ -f "$CERT" ]; then
cp -vf "$CERT" "$DEST_CERT"
cp -vf "$KEY" "$DEST_KEY"
else
cat /data/localhost.cert.pem /data/root_ca.crt > "$DEST_CERT"
cp -vf /data/localhost.key.pem "$DEST_KEY"
fi
cp -vf /docker/config/nginx.conf /etc/nginx/nginx.conf
exec "$@"