Skip to content

Commit

Permalink
update packages; fix cors configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
liisaratsep committed Feb 16, 2024
1 parent f0430dc commit 7a55322
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
7 changes: 3 additions & 4 deletions app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@

app = FastAPI(
title="Grammatical Error Correction",
version=api_settings.version,
version=api_settings.version if api_settings.version else "dev",
description="A service that performs automatic grammatical error correction."
)

app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_methods=["*"],
allow_headers=["*"],
allow_credentials=True,
allow_headers=["*"]
)


Expand All @@ -42,7 +41,7 @@ async def shutdown():
@app.get('/health/startup', include_in_schema=False)
@app.get('/health/liveness', include_in_schema=False)
async def health_check():
# Returns 200 the connection to RabbitMQ is up
# Returns 200 if connection to RabbitMQ is up
if mq_connector.channel is None or mq_connector.channel.is_closed:
raise HTTPException(500)
return "OK"
Expand Down
3 changes: 2 additions & 1 deletion app/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import Optional
from pydantic import BaseSettings, validator


Expand All @@ -14,9 +15,9 @@ class Config:


class APISettings(BaseSettings):
version: str
max_input_length: int = 10000
languages: str = "et" # comma-separated list of 2-letter codes
version: Optional[str]

@validator('languages')
def list_languages(cls, v):
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aio-pika==8.0.3
fastapi==0.78.0
uvicorn==0.18.2
pydantic==1.9.1
aio-pika==9.4.0
fastapi==0.109.2
uvicorn==0.27.1
pydantic<2.0.0

0 comments on commit 7a55322

Please sign in to comment.