mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Now, when a `./cache/production.{cert,key}.pem` pair is found, it is used in place of any certificates generated by the `ca` service. This allows users to customize the certificate that the FastAPI ASGI server uses as well as the front-end nginx certificates. Optional: - ./cache/production.cert.pem - ./cache/production.key.pem Fallback: - ./cache/localhost.cert.pem + ./cache/root.ca.pem (chain) - ./cache/localhost.key.pem Signed-off-by: Kevin Morris <kevr@0cost.org>
30 lines
808 B
Bash
Executable file
30 lines
808 B
Bash
Executable file
#!/bin/bash
|
|
|
|
CERT=/cache/localhost.cert.pem
|
|
KEY=/cache/localhost.key.pem
|
|
|
|
# If production.{cert,key}.pem exists, prefer them. This allows
|
|
# user customization of the certificates that FastAPI uses.
|
|
if [ -f /cache/production.cert.pem ]; then
|
|
CERT=/cache/production.cert.pem
|
|
fi
|
|
if [ -f /cache/production.key.pem ]; then
|
|
KEY=/cache/production.key.pem
|
|
fi
|
|
|
|
if [ "$1" == "uvicorn" ] || [ "$1" == "" ]; then
|
|
exec uvicorn --reload \
|
|
--ssl-certfile "$CERT" \
|
|
--ssl-keyfile "$KEY" \
|
|
--log-config /docker/logging.conf \
|
|
--host "0.0.0.0" \
|
|
--port 8000 \
|
|
aurweb.asgi:app
|
|
else
|
|
exec hypercorn --reload \
|
|
--certfile "$CERT" \
|
|
--keyfile "$KEY" \
|
|
--log-config /docker/logging.conf \
|
|
-b "0.0.0.0:8000" \
|
|
aurweb.asgi:app
|
|
fi
|