From 9e4c0967e0260f75cd1f8535ce103924d727aa88 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sat, 28 Oct 2017 14:28:29 +0200 Subject: [PATCH] [Misc] Make certificate file directory customizable --- init.el | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/init.el b/init.el index 4847f86..4aa6b46 100644 --- a/init.el +++ b/init.el @@ -649,10 +649,22 @@ _h_ _l_ _o_k _y_ank gnutls-min-prime-bits 1024 gnutls-verify-error t) - ;; add own trustfiles - (dolist (cert-file - (directory-files "~/.local/etc/certs" t "\.crt$")) - (add-to-list 'gnutls-trustfiles cert-file)))) + (defun db/update-cert-file-directory (symbol new-value) + "Set SYMBOL to NEW-VALUE and, assuming that NEW-VALUE points +to a directory, add all certificate files in it to +`gnutls-trustfiles’. + +Certificates are assumed to be of the form *.crt." + (set symbol new-value) + (when (file-directory-p new-value) + (dolist (cert-file (directory-files new-value)) + (add-to-list 'gnutls-trustfiles cert-file)))) + + (defcustom db/cert-file-directory "~/.local/etc/certs" + "Local directory with additional certificates." + :group 'personal-settings + :type 'string + :set #'db/update-cert-file-directory))) (use-package epg :defer t