ЛР 7: TLS/mTLS, Argon2id, OpenBao и negative tests (оценка 3)
Skeleton contracts / contracts (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"""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,
|
||||
)
|
||||
Reference in New Issue
Block a user