Archived
1 parent
f5bdd7e21c
commit
affe28ad71
110 files changed
+52936
-14
No files matched your search
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
APP_DIR=/opt/wgtools
|
||||
UVICORN="$APP_DIR/.venv/bin/uvicorn"
|
||||
HTTP_PORT="${WGTOOLS_PORT:-8341}"
|
||||
HTTPS_ENABLED="${WGTOOLS_HTTPS_ENABLED:-0}"
|
||||
HTTPS_PORT="${WGTOOLS_HTTPS_PORT:-443}"
|
||||
CERT_FILE="${WGTOOLS_SSL_CERTFILE:-/etc/letsencrypt/live/wgtools/fullchain.pem}"
|
||||
KEY_FILE="${WGTOOLS_SSL_KEYFILE:-/etc/letsencrypt/live/wgtools/privkey.pem}"
|
||||
|
||||
args=(app.main:application --host 0.0.0.0 --workers 1)
|
||||
if [[ "$HTTPS_ENABLED" == "1" ]]; then
|
||||
if [[ ! -r "$CERT_FILE" || ! -r "$KEY_FILE" ]]; then
|
||||
echo "WGTools HTTPS is enabled but certificate files are not readable:" >&2
|
||||
echo " cert: $CERT_FILE" >&2
|
||||
echo " key: $KEY_FILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
args+=(--port "$HTTPS_PORT" --ssl-certfile "$CERT_FILE" --ssl-keyfile "$KEY_FILE")
|
||||
else
|
||||
args+=(--port "$HTTP_PORT")
|
||||
fi
|
||||
|
||||
exec "$UVICORN" "${args[@]}"
|
||||
Reference in new issue
Block a user