mirror of
https://github.com/mattintech/simplefileupload-server.git
synced 2026-07-11 15:21:53 +00:00
20 lines
425 B
Python
20 lines
425 B
Python
|
|
import os
|
||
|
|
import subprocess
|
||
|
|
|
||
|
|
cert = os.getenv("SSL_CERT", "cert.pem")
|
||
|
|
key = os.getenv("SSL_KEY", "key.pem")
|
||
|
|
|
||
|
|
use_ssl = os.path.exists(cert) and os.path.exists(key)
|
||
|
|
|
||
|
|
base_cmd = [
|
||
|
|
"gunicorn", "wsgi:app", "--bind", "0.0.0.0:7777"
|
||
|
|
]
|
||
|
|
|
||
|
|
if use_ssl:
|
||
|
|
print("🟢 Starting with HTTPS")
|
||
|
|
base_cmd += ["--certfile", cert, "--keyfile", key]
|
||
|
|
else:
|
||
|
|
print("🟡 Starting with HTTP (no certs found)")
|
||
|
|
|
||
|
|
subprocess.run(base_cmd)
|