Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add CORS configuration #62

Merged
merged 3 commits into from
Nov 23, 2023
Merged

feat: add CORS configuration #62

merged 3 commits into from
Nov 23, 2023

Conversation

raphodn
Copy link
Member

@raphodn raphodn commented Nov 23, 2023

What

https://fastapi.tiangolo.com/tutorial/cors/

  • add cors configuration in app.py
  • update .env
  • update docker config

@raphodn raphodn self-assigned this Nov 23, 2023
@raphodn raphodn requested a review from raphael0202 November 23, 2023 13:55
app/config.py Outdated
@@ -36,6 +36,7 @@ class Settings(BaseSettings):
postgres_password: str
postgres_host: str
postgres_port: int = 5432
cors_allow_origins: list = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't you use a Field with a default factory here?
https://docs.pydantic.dev/latest/concepts/fields/#default-values
And you can use list[str]

Copy link
Member Author

@raphodn raphodn Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes you're right, I fixed it here : 0fa085b

this helped : https://docs.pydantic.dev/latest/concepts/pydantic_settings/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not yet a pro of these typings in python ^^

@raphael0202 raphael0202 self-requested a review November 23, 2023 14:11
@raphodn raphodn merged commit 79de31b into main Nov 23, 2023
4 checks passed
@raphodn raphodn deleted the raphodn/add-cors branch November 23, 2023 14:32
@raphodn raphodn linked an issue Nov 23, 2023 that may be closed by this pull request
raphodn added a commit that referenced this pull request Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CORS configuration
2 participants