Skip to content
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(config): expand home in GitHub token file read and use token for rate #88

Merged
merged 1 commit into from
Oct 22, 2023

Conversation

hhromic
Copy link
Contributor

@hhromic hhromic commented Oct 21, 2023

This PR fixes three issues I found while testing the new GitHub token reading from files:

  • The ~/ home directory shortcut was not expanded, for example in @~/secrets/github-token.
  • When loading a GitHub token from file, the newline/carriage-return at the end of the file were also read into the token.
  • When using the --rate option, the GitHub token stored in a config file was not used.

For the second point I used strings.TrimRight(), which strips any of the \r\n runes. Therefore, the trimming works properly for all OS line-ending styles (Unix, Mac, Windows).

To fix the third point, I had to separate the loading of global options from project options into two different functions so the global options can be loaded earlier for the --rate option to have a populated GitHub token from a config file.

@hhromic hhromic changed the title fix(config): expand home in github_token config and use token for rate fix(config): expand home in GitHub token file read and use token for rate Oct 21, 2023
…rate

* also trim newline and carriage-return from the read token file
@zyedidia zyedidia merged commit 5f6d1c9 into zyedidia:master Oct 22, 2023
@hhromic hhromic deleted the fix-token-read branch October 22, 2023 08:00
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.

None yet

2 participants