Compare commits
No commits in common. "e3c2f3dea0d6f476aa0795f543aead1599172afd" and "382ab2da25c2185cdfb80430f30dc0264f757d84" have entirely different histories.
e3c2f3dea0
...
382ab2da25
@ -18,24 +18,6 @@ services:
|
|||||||
parallelism: 1
|
parallelism: 1
|
||||||
order: start-first
|
order: start-first
|
||||||
|
|
||||||
queues:
|
|
||||||
image: mathwave/sprint-repo:queues
|
|
||||||
networks:
|
|
||||||
- queues
|
|
||||||
environment:
|
|
||||||
MONGO_HOST: "mongo.develop.sprinthub.ru"
|
|
||||||
MONGO_PASSWORD: $MONGO_PASSWORD_DEV
|
|
||||||
NEW: "true"
|
|
||||||
deploy:
|
|
||||||
mode: replicated
|
|
||||||
restart_policy:
|
|
||||||
condition: any
|
|
||||||
update_config:
|
|
||||||
parallelism: 1
|
|
||||||
order: start-first
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
common-infra-nginx:
|
common-infra-nginx:
|
||||||
external: true
|
external: true
|
||||||
queues:
|
|
||||||
external: true
|
|
||||||
|
@ -18,25 +18,6 @@ services:
|
|||||||
parallelism: 1
|
parallelism: 1
|
||||||
order: start-first
|
order: start-first
|
||||||
|
|
||||||
queues:
|
|
||||||
image: mathwave/sprint-repo:queues
|
|
||||||
networks:
|
|
||||||
- common-infra-nginx
|
|
||||||
- queues
|
|
||||||
environment:
|
|
||||||
MONGO_HOST: "mongo.sprinthub.ru"
|
|
||||||
MONGO_PASSWORD: $MONGO_PASSWORD_PROD
|
|
||||||
NEW: "true"
|
|
||||||
deploy:
|
|
||||||
mode: replicated
|
|
||||||
restart_policy:
|
|
||||||
condition: any
|
|
||||||
update_config:
|
|
||||||
parallelism: 1
|
|
||||||
order: start-first
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
common-infra-nginx:
|
common-infra-nginx:
|
||||||
external: true
|
external: true
|
||||||
queues:
|
|
||||||
external: true
|
|
||||||
|
16
main.py
16
main.py
@ -8,9 +8,23 @@ from app.routers import finish
|
|||||||
|
|
||||||
from app.storage import mongo
|
from app.storage import mongo
|
||||||
|
|
||||||
|
from fastapi import responses
|
||||||
|
|
||||||
|
|
||||||
|
QUEUES_TOKEN = os.getenv('QUEUES_TOKEN')
|
||||||
|
|
||||||
app = fastapi.FastAPI()
|
app = fastapi.FastAPI()
|
||||||
|
|
||||||
|
|
||||||
|
@app.middleware('http')
|
||||||
|
async def check_token(request: fastapi.Request, call_next):
|
||||||
|
if QUEUES_TOKEN:
|
||||||
|
token = request.headers.get('X-Queues-Token')
|
||||||
|
if not token or token != QUEUES_TOKEN:
|
||||||
|
return responses.JSONResponse(status_code=403, content={'message': 'token is not provided or incorrect'})
|
||||||
|
return await call_next(request)
|
||||||
|
|
||||||
|
|
||||||
app.include_router(take.router)
|
app.include_router(take.router)
|
||||||
app.include_router(put.router)
|
app.include_router(put.router)
|
||||||
app.include_router(finish.router)
|
app.include_router(finish.router)
|
||||||
@ -19,6 +33,4 @@ mongo.create_indexes()
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if os.getenv('NEW') == 'true':
|
|
||||||
uvicorn.run(app, host="0.0.0.0", port=1239)
|
|
||||||
uvicorn.run(app, host="0.0.0.0", port=1238)
|
uvicorn.run(app, host="0.0.0.0", port=1238)
|
||||||
|
Loading…
Reference in New Issue
Block a user