Commit graph

137 commits

Author SHA1 Message Date
William Martin
c9de817865 Avoid using keyring unnecessarily in AuthConfig tests
This is to avoid the impression that the keyring matters, when the test
is actually about general auth behaviour
2023-10-19 12:26:52 +02:00
William Martin
fa80802c81 Add tests for AuthConfig DefaultHost 2023-10-19 12:24:25 +02:00
William Martin
07f5ca48d8 Share config.Read setup in AuthConfig tests 2023-10-19 12:24:05 +02:00
William Martin
e0bc2ff0ca Add test that host is added on Login 2023-10-19 12:08:03 +02:00
William Martin
cb7672e573 Add additional comment on Logout ignoring errors 2023-10-19 12:05:40 +02:00
William Martin
3380831672 Rewrite AuthConfig User and GitProtocol tests 2023-10-19 12:05:14 +02:00
William Martin
e011633cdc Add tests for AuthConfig HasEnvToken 2023-10-18 18:10:00 +02:00
William Martin
07110eca33 Add tests for AuthConfig Token 2023-10-18 17:51:53 +02:00
William Martin
52ba99ebab Update AuthConfig to use default fn 2023-10-18 17:51:41 +02:00
William Martin
614e49296b Add tests for AuthConfig Login and Logout 2023-10-18 17:09:20 +02:00
William Martin
34b0b33f24 Add initial AuthConfig tests 2023-10-18 16:31:13 +02:00
William Martin
5f645eaded Add tests for config GetOrDefault 2023-10-18 16:10:53 +02:00
William Martin
b94f458950 Add initial tests for config Get 2023-10-18 15:51:46 +02:00
Keith Bailey
97755c6bf0
Document when gh auth login writes oauth token to plain text (#7781) 2023-09-18 11:34:13 +02:00
Sam Coe
bf7db84ca8
Add timeouts to keyring operations (#7580) 2023-06-20 23:45:20 +00:00
Alexander Seiler
218f29f296
Correct some typos 2023-04-21 03:51:31 +02:00
Sam Coe
dbc2f05124
Update go-gh to v2 (#7299)
* Update go-gh

* Update code for go-gh v2
2023-04-16 15:34:23 +10:00
Sam Coe
39805fa9b1
Properly handle closing files that have been writen to (#7199) 2023-03-23 01:17:47 +00:00
Benjamin Levesque
9596fd5368
Skip checking keyring for token in certain scenarios (#7169) 2023-03-18 08:59:43 +11:00
Sam Coe
c9a2d85793
Cleanup config.AuthToken and config.DefaultHost methods (#7049) 2023-02-28 00:24:45 +00:00
Sam Coe
df83dc2d58
Add ability to store tokens in encrypted storage (#7043) 2023-02-28 00:04:53 +00:00
Sam Coe
a33e12a21d
Refactor Config interface in preperation for encrypted token storage (#7033) 2023-02-28 10:51:12 +11:00
Mislav Marohnić
e4f5545e86
Go 1.19: fix comment formatting for moq-generated mocks 2022-12-12 16:58:25 +01:00
Sam Coe
6dbe7e6342
Linter fixes (#6722)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2022-12-12 15:27:32 +00:00
Sam Coe
ebc681be05
Replace os.Setenv with t.Setenv (#6345) 2022-09-26 13:37:34 +04:00
Sam Coe
1e8cb9c1b2
Fix login flow (#5928) 2022-07-12 15:46:35 +02:00
Sam Coe
cacff4ad6d
Use go-gh config package (#5771) 2022-06-23 11:50:04 +00:00
Håvard Anda Estensen
58cb773e09
Replace ioutil with io and os (#5498) 2022-04-26 13:07:44 +02:00
Naïm Favier
8dbd07212c
Stop auth commands from modifying global config file (#5378) 2022-04-11 17:26:18 +02:00
Kevin Lee
0d143ca89c
Consistent punctuation in command usages (#5139)
* Fix spelling and grammatical errors in command docs
* Add periods for consistency across the long command descriptions
* Format imports
2022-01-31 10:56:12 +00:00
Sam Coe
ba8c41a6ed
Add GH_HOST to hosts list if it has corresponding auth token (#5087)
* Add GH_HOST to hosts list if it has coresponding auth token

* Keep default host at front of hosts list

* Always add GH_HOST to hosts list
2022-01-29 07:37:24 +00:00
nate smith
30a30bee2e remove todo 2022-01-14 15:34:06 -06:00
nate smith
0a619d422a undo overzealous find/replace 2022-01-14 15:27:05 -06:00
nate smith
562f1b3d0d add GetOrDefault functionality to config 2022-01-11 14:56:58 -06:00
Josef Šimánek
f2848fcdda
Update StateDir comment to mention XDG_STATE_HOME. 2021-12-16 20:07:33 +01:00
Sam Coe
f1fbfdf6d0
Fix up bug in RemoveEntry and add tests for config_map 2021-11-22 09:24:03 -08:00
Marwan Sulaiman
a3940020f9
Inherit API endpoint configuration from the Codespaces environment (#4723)
gh codespace commands now respect the following environment variables:

- GITHUB_SERVER_URL: typically "https://github.com"
- GITHUB_API_URL: typically "https://api.github.com"
- INTERNAL_VSCS_TARGET_URL: typically "https://online.visualstudio.com"
- GITHUB_TOKEN when CODESPACES is set, even if the host connecting to isn't "github.com".

This set of changes ensures that `gh codespace` commands automatically connect to the right API endpoints when gh is used within a codespace.

Co-authored-by: Mislav Marohnić <mislav@github.com>
2021-11-22 12:40:01 +01:00
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
Sam
8fb6bb66c8
Merge pull request #3992 from despreston/858-config-browser
add browser option to config
2021-08-17 14:17:54 -07:00
Sam Coe
315c6e4eb7
Remove backwards compatibility with homedir library for config files 2021-08-17 10:28:16 -07:00
Sam Coe
34b3d5bb86
Add tests and a little polish 2021-08-17 10:05:54 -07:00
Mislav Marohnić
aec0f10041 Fix error message when using GH_ENTERPRISE_TOKEN but host is ambiguous
Before:

    $ GH_ENTERPRISE_TOKEN="..." gh pr create
    could not find hosts config: not found

Now:

    $ GH_ENTERPRISE_TOKEN="..." gh pr create
    set the GH_HOST environment variable to specify which GitHub host to use

Also amends `gh help environment` documentation to suggest the use of
GH_HOST when scripting operations with GitHub Enterprise repositories.
2021-07-20 14:11:07 +02:00
Mislav Marohnić
25b6eecc8d
Merge pull request #4017 from despreston/des/avoid-migrate
Skip auto migrate of config when GH_CONFIG_DIR
2021-07-20 13:33:16 +02:00
Des Preston
1c9b4bf99d Skip auto migrate of config when GH_CONFIG_DIR
If GH_CONFIG_DIR is set, don't auto migrate the config file. This fixes
the situation where the path given via GH_CONFIG_DIR does not exist and
the cli attempts to migrate an existing config to that location.

Fixes #3837
2021-07-19 16:33:51 -04:00
Des Preston
c95f30af80 add browser option to config
Allows setting the path to the browser using the config.

Closes #858
2021-07-13 15:07:57 -04:00
Sam Coe
b514d22f1e
Fix issue in FindEntry that causes extensions and alias crash 2021-06-29 15:01:00 -07:00
jonathan gold
5f162561ac Add config handling for http_unix_socket 2021-06-25 11:47:22 -07:00
Sam Coe
e6ad8a10d0
Add support for XDG_DATA_HOME 2021-06-02 09:46:14 -04:00
Sam Coe
1d7ffc2013
Add support for LocalAppData and .local/state/ fallback 2021-06-01 15:50:10 -04:00
Sam Coe
602167c0c7
Address PR comments 2021-05-26 11:28:58 -04:00