Skip to content

Commit 5cbf148

Browse files
gptel-gh: Update README and docstrings
1 parent e790b96 commit 5cbf148

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

README.org

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,8 +1089,18 @@ However private endpoints can be configure like so -
10891089
:host "api.business.githubcopilot.com")
10901090
#+end_src
10911091

1092-
You will be informed to login into =GitHub= as required.
1093-
You can pick this backend from the menu when using gptel (see [[#usage][Usage]]).
1092+
You will be informed to login into =GitHub= as required. You can pick this backend from the menu when using gptel (see [[#usage][Usage]]).
1093+
1094+
The GitHub OAuth token is stored by default in a cleartext file based on the path stored in =gptel-gh-github-token-file=. It is possible to customize the variables =gptel-gh-github-token-load-function= and =gptel-gh-github-token-save-function= to change this behavior. If the token is e.g. stored in a password manager, then the following example can be used to so that the token is read as a password:
1095+
1096+
#+begin_src emacs-lisp
1097+
(setq
1098+
;; Prompt user to provide the token as a password
1099+
gptel-gh-github-token-load-function (lambda () (read-passwd "Copilot token: "))
1100+
1101+
;; Display a message when a new token has been stored, so that it can be copied from the message history
1102+
gptel-gh-github-token-save-function (lambda (token) (message "Token saved: %s" token)))
1103+
#+end_src
10941104

10951105
***** (Optional) Set as the default gptel backend
10961106

gptel-gh.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@
152152
:group 'gptel)
153153

154154
(defcustom gptel-gh-github-token-load-function 'gptel--gh-restore-from-file
155-
"Function to load the current github token."
155+
"Function to load the current github token. Default behavior is file-based based on `gptel-gh-github-token-file'."
156156
:type 'function
157157
:group 'gptel)
158158

159159
(defcustom gptel-gh-github-token-save-function 'gptel--gh-save-to-file
160-
"Function to save the new github token."
160+
"Function to save the new github token. Default behavior is file-based based on `gptel-gh-github-token-file'."
161161
:type 'function
162162
:group 'gptel)
163163

0 commit comments

Comments
 (0)