Skip to content

Commit

Permalink
Merge pull request #130 from QActf/CORS_back
Browse files Browse the repository at this point in the history
CORS
  • Loading branch information
CuriousGecko authored Sep 11, 2024
2 parents 3117ff5 + acca2dd commit 191becc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 1 addition & 8 deletions app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,7 @@ class Settings(BaseSettings):
EMAIL_USE_TLS: bool = True
# ================================

origins: list[str] = [
'http://localhost',
'http://localhost:3000',
'http://localhost:8080',
'http://127.0.0.1',
'http://127.0.0.1:3000',
'http://127.0.0.1:8080',
]
host: str = 'localhost'

class Config:
env_file = 'infra/.env'
Expand Down
4 changes: 3 additions & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ def swagger_monkey_patch(*args, **kwargs):
openapi_url="/api/openapi.json",
)

origins = [f'http://{settings.host}']

app.add_middleware(
CORSMiddleware,
allow_origins=settings.origins,
allow_origins=origins,
allow_credentials=True,
allow_methods=['*'],
allow_headers=['*'],
Expand Down

0 comments on commit 191becc

Please sign in to comment.