Skip to content

Add support for overriding the github url#3

Merged
laughedelic merged 1 commit intolaughedelic:mainfrom
justinmchase:feature/support-alternate-api-urls
Feb 4, 2022
Merged

Add support for overriding the github url#3
laughedelic merged 1 commit intolaughedelic:mainfrom
justinmchase:feature/support-alternate-api-urls

Conversation

@justinmchase
Copy link
Contributor

@justinmchase justinmchase commented Jan 26, 2022

I tested locally with my github-enterprise url and it worked. Not specifying a url will safely fallback to the default without any errors.

Fixes #2

Copy link
Owner

@laughedelic laughedelic left a comment

Choose a reason for hiding this comment

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

Thanks for the addition, and sorry for the late reply.

See the comment about permissions. I'm going to merge this as is and add my changes on main.

@@ -1,4 +1,4 @@
const githubApiUrl = "https://api.github.com";
const githubApiUrl = Deno.env.get("GITHUB_API_URL") ?? "https://api.github.com";
Copy link
Owner

Choose a reason for hiding this comment

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

This will break existing scripts (if they don't pin the current release version) because doing Deno.env.get requires more permissions. So if this is installed without --allow-env, this line will throw an exception.

I'll try to wrap it into a check whether the script has permissions to access env, so that if it doesn't we can still use the default URL.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great point, I was just using -A and hadn't thought about that. Very naughty of me, I'll update my testing procedure.

@laughedelic laughedelic merged commit 37c51c4 into laughedelic:main Feb 4, 2022
@laughedelic
Copy link
Owner

This is now released as https://deno.land/x/github_app_auth@v0.1.3

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.

Github api url from env

2 participants