-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add CGI middleware for requests to People API #346
Conversation
f9ee659
to
e5facf6
Compare
note: we should make sure there aren't CORS errors on either side, those are starting to show up again |
The request from the |
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 like this setup a lot! Very simple and elegant, and importantly, the same between prod and local. A few comments:
There's no indication of a problem if credentials.ini
is missing/wrong, it just doesn't get the year (and doesn't print that it didn't). Could you please add some indicator so we (and new devs) don't get tripped up by this? Not sure where the best place is. Even an error would be good I think, so we can tell it's happening.
Also, I deployed to dev and it didn't seem to work (no year printout, no cookie). Might be related to the ambiguous Error: Request failed with status code 404
.
Can you also add the additional setup instructions to the README please? (like python packages, how to get credentials, etc)
e5facf6
to
4535083
Compare
cgi-bin/people.py
Outdated
print(error + content) | ||
print(dumps(output)) |
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.
these two lines appear in every case, I think. can't we just put them once at the end?
* Add CGI wrapper for People API requests * Add CGI handler to dev server * Point Auth to new People API endpoint * Deploy cgi-bin * Condense print statements in CGI script Co-authored-by: Nate Foss <[email protected]>
This PR adds a new
CGI
handler calledpeople.py
that is responsible for making requests to thePeople API
on behalf of anyCourseRoad
clients. Requests can be made to this endpoint with a user'skerb
and the API will return either an error or the year of the user zero-indexed. This resolves an issue in which the credentials for interacting with the API was stored directly in the client-side code.This PR also modifies the logic of the
webpack-dev-server
to allow for it to run its ownCGI
handler so that this logic can be tested during development as well. For this to work properly, each person will need to obtain a copy ofcredentials.ini
to set up this script (which I currently have) since these credentials will not be committed toGitHub
.A few changes will need to be made once this is merged into
master
to make sure this works properly, including setting up any dependencies that thisCGI
middleware requires onScripts
. Once this is approved by someone, I'll start testing ondev
before deploying to production.