-
-
Notifications
You must be signed in to change notification settings - Fork 8
Tips and Tricks
John Hamelink edited this page Jul 29, 2022
·
2 revisions
This snippet allows you to store your RTorrent RPC URL in a gpg-encrypted file. Make sure you have GPG set up before continuing.
First append to the ~/.authinfo.gpg
file like so:
machine <hostname> login <username>^rtorrent password https://<username>:<password>@<hostname>:<port><path>/RPC2
Then add this to your emacs config:
(defun my/fetch-password (&rest params)
"Fetch password from ~/authinfo.gpg."
(require 'auth-source)
(let ((match (car (apply 'auth-source-search params))))
(if match
(let ((secret (plist-get match :secret)))
(if (functionp secret)
(funcall secret)
secret))
(error "Password not found for %S" params))))
(setq mentor-rtorrent-external-rpc
(my/fetch-password :host "<hostname>" :user "<username>^rtorrent"))