Skeleton contracts / contracts (pull_request) Canceled after 0s
27 lines
818 B
Python
27 lines
818 B
Python
"""Local entry point: python -m app (HTTPS with required client cert inside the mesh)."""
|
|
import os
|
|
import ssl
|
|
|
|
import uvicorn
|
|
|
|
if __name__ == "__main__":
|
|
cert = os.environ.get("TLS_CERTFILE")
|
|
key = os.environ.get("TLS_KEYFILE")
|
|
options = {}
|
|
if cert and key:
|
|
options = dict(
|
|
ssl_certfile=cert,
|
|
ssl_keyfile=key,
|
|
ssl_ca_certs=os.environ.get("TLS_CLIENT_CA", "/certs/ca.crt"),
|
|
ssl_cert_reqs=ssl.CERT_REQUIRED if os.environ.get("TLS_REQUIRE_CLIENT", "1") == "1"
|
|
else ssl.CERT_NONE,
|
|
)
|
|
uvicorn.run(
|
|
"app.main:app",
|
|
host=os.environ.get("APP_HOST", "0.0.0.0"),
|
|
port=int(os.environ.get("APP_PORT", "8443")),
|
|
workers=1,
|
|
log_level=os.environ.get("LOG_LEVEL", "info"),
|
|
**options,
|
|
)
|