just icon indicating copy to clipboard operation
just copied to clipboard

feat(installer): add github token support

Open jpeeler opened this issue 9 months ago • 8 comments

This adds support for utilizing the env var GITHUB_TOKEN if it exists for both curl/wget download utils. fixes #2664

I think this would be a nice way to help alleviate rate limiting issues for those who can provide a token. My only concern is that perhaps some people may be upset if they are running this script unpiped and are utilizing github actions such that the -x output shows the token in some logs. Otherwise, perhaps this is a nice feature enhancement? Edit: this is handled now.

Would be nice to not have to fork the installer, though it seems that changes are pretty rare.

jpeeler avatar Mar 21 '25 21:03 jpeeler

What do you think now? It uses a config file to avoid ps output and turns off xtrace for the temp config file writing that only occurs when GITHUB_TOKEN is set.

jpeeler avatar Mar 24 '25 22:03 jpeeler

Less crazy?

jpeeler avatar Mar 27 '25 21:03 jpeeler

I could not get your version to quite work correctly. I read that "wget tries to interpret any non-option argument as a URL" so was seeing a spurious "Prepended http:// to ''" when the token wasn't set. And then curl's parsing also seemed to not like an empty argument, so I gave up and conditioned it all. If this is unacceptable I'll just fork. (But I do think that it's not a coincidence that this issue came up from somebody else - I assume github changed their rate limiting.)

jpeeler avatar Mar 28 '25 22:03 jpeeler

@jpeeler I believe that the Prepended http:// to message can be avoided.

If you have an empty variable which is unquoted, then it won't be passed as an argument at all. args is a script which prints the arguments it is passed. In the first call, $x is unquoted, so args doesn't see it at all. In the second call, $x is quoted, so args receives the empty string:

x=
$ args $x
0: /Users/rodarmor/bin/args
$ args "$x"
0: /Users/rodarmor/bin/args
1:

So we could use an unquoted string variable. However, I think the best answer is actually to use an array variable, conditionally push the additional --header argument, and then unconditionally supply the array variable to the invocation.

casey avatar Mar 29 '25 20:03 casey

I can't get any combination that works correctly for both when the token is defined and when it isn't (aside from my latest revision). Also, array variables are bash only I think.

jpeeler avatar Mar 31 '25 15:03 jpeeler

Hrm, I just now noticed that the standard install command line you have documented is actually using bash. I hadn't been testing that way, so I'll adjust and try yet again to get this right.

jpeeler avatar Apr 01 '25 14:04 jpeeler

@casey Simple/good enough?

jpeeler avatar Apr 04 '25 16:04 jpeeler

@casey One more ping since I think you do want this little feature.

jpeeler avatar Apr 09 '25 17:04 jpeeler

Thanks for pushing this over the finish line! Will the http://just.systems/install.sh file be updated during the next release?

jpeeler avatar Jul 07 '25 19:07 jpeeler

Yup, that's correct. The website is served on GitHub pages, which gets updated on new releases.

casey avatar Jul 07 '25 20:07 casey