add: subclass UvicornWorker to provide subpath

v0.2
rrr-marble 4 years ago
parent 776460ace2
commit 0f0505b3c4

@ -24,6 +24,6 @@ CMD [ \
# might use exact migration hash here instead of upgrading to the latest "heads" # might use exact migration hash here instead of upgrading to the latest "heads"
"alembic upgrade heads \ "alembic upgrade heads \
&& \ && \
gunicorn --workers=2 --worker-class=uvicorn.workers.UvicornWorker --bind=0.0.0.0:8000 \ gunicorn --workers=2 --worker-class=util.MyUvicornWorker --bind=0.0.0.0:8000 \
geodata.main:app --root-path=/api/v1" \ geodata.main:app" \
] ]

@ -0,0 +1,5 @@
from uvicorn.workers import UvicornWorker
class MyUvicornWorker(UvicornWorker):
CONFIG_KWARGS = {"root-path": "/api/v1"}
Loading…
Cancel
Save