-
Notifications
You must be signed in to change notification settings - Fork 16
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
Fix the Issue with the Snapshot API #38
Conversation
EndeavorPal
commented
Apr 14, 2024
- Update CORS Logic
- Add Commit after Insert Snapshot Record
- Deserialize Snapshot Data before Return in the Response
- Add Script to execute sql files that create required database tables
2. Add Commit after Insert Snapshot Record 3. Deserialize Snapshot Data before Return in the Response 4. Add Script to execute sql files that create required database tables
@@ -0,0 +1,49 @@ | |||
import os |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate this, but isn't it just easier to do
% psql < sql/*.sql
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that works too.
Here, we can include custom logic before running the SQL statement.
|
||
# Origins to be allowed by the backend | ||
ORIGINS=https://beta.ansari.chat,http://beta.ansari.chat,https://ansari.chat,http://ansari.chat,https://hajiansari.ai,http://hajiansari.ai,https://ansari.endeavorpal.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for making this change it is long overdue.
@@ -46,7 +40,7 @@ | |||
app = FastAPI() | |||
app.add_middleware( | |||
CORSMiddleware, | |||
allow_origins=origins, | |||
allow_origins=['*'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This particular line change replaces the list of specific origins with a wildcard ('*'), allowing all domains to access resources from our application. Was this change intended, or was it made by mistake? @EndeavorPal @waleedkadous
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its intended for mobile (where the origin is not defined). Its not detrimental because of the additional origins check on line 61.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this to handle mobile, also origin validation already handled in line 67
if origin in origins or mobile == "ANSARI":