-
Notifications
You must be signed in to change notification settings - Fork 20
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 redirect to GitHub repo and add authorization #6
base: master
Are you sure you want to change the base?
Conversation
Someone is attempting to deploy a commit to a Personal Account owned by @Contextualist on Vercel. @Contextualist first needs to authorize it. |
I don't know if I did the environment variables correctly for Vercel, but authorization works locally |
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.
Thanks for contributing! Recently I did notice GitHub’s increasing throttle to unauthorized API requests, so this config would be quite helpful.
|
||
@app.route('/') | ||
def redir(): | ||
return redirect("https://github.com/Contextualist/glare") |
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.
Nice to have😉, but let's move it to vercel.json
: { "src": "/", "status": 301, "headers": { "Location": "https://github.com/Contextualist/glare" } }
@@ -47,7 +58,7 @@ def get_release(user, repo_ver, name_re): | |||
return redirect(matched[0]) | |||
|
|||
def api_req(url): | |||
resp = httpx.get(url) | |||
resp = httpx.get(url, headers={'Authorization': config['GITHUB_AUTHORIZATION']}) if ast.literal_eval(config['GITHUB_IS_AUTHORIZED']) == True else httpx.get(url) |
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 might want to simplify things a bit: if GITHUB_TOKEN
is set and is non-empty, add the auth header.
"env": { | ||
"GITHUB_AUTHORIZATION": "Bearer YOUR-TOKEN", | ||
"GITHUB_IS_AUTHORIZED": "False" | ||
} |
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.
Maybe just use .env
file as the default only way of managing the environment variables, so that it's less confusing to users.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
No description provided.