From 2d8313b9b91fd104faf9d102910c10d022b91926 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Mon, 22 Dec 2014 20:32:58 +0000 Subject: [PATCH] zone.lisp, frontend.lisp: New configuration-variable machinery. Maintain a list `*zone-config*' of configuration variables, and have the frontend rebind these around each input file. Add `*sshfp-pathname-defaults*' and `*dkim-pathname-defaults*' to the list. --- frontend.lisp | 5 +++-- zone.lisp | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/frontend.lisp b/frontend.lisp index 0764c3f..613fb21 100644 --- a/frontend.lisp +++ b/frontend.lisp @@ -107,8 +107,9 @@ (let ((*package* (make-package "ZONE.SCRATCH" :use '(#:common-lisp #:net #:zone)))) - (load f :verbose nil :print nil :if-does-not-exist :error) - (delete-package *package*))) + (progv *zone-config* (mapcar #'symbol-value *zone-config*) + (load f :verbose nil :print nil :if-does-not-exist :error) + (delete-package *package*)))) (zone-save opt-zones :format opt-format))) (with-unix-error-reporting () (unless (option-parse-try diff --git a/zone.lisp b/zone.lisp index c800f1f..e43e017 100644 --- a/zone.lisp +++ b/zone.lisp @@ -35,6 +35,14 @@ ;;;-------------------------------------------------------------------------- ;;; Various random utilities. +(export '*zone-config*) +(defparameter *zone-config* nil + "A list of configuration variables. + + This is for the benefit of the frontend, which will dynamically bind them + so that input files can override them independently. Not intended for use + by users.") + (defun to-integer (x) "Convert X to an integer in the most straightforward way." (floor (rational x))) @@ -868,6 +876,7 @@ (defvar *dkim-pathname-defaults* (make-pathname :directory '(:relative "keys") :type "dkim")) +(pushnew '*dkim-pathname-defaults* *zone-config*) (defzoneparse :dkim (name data rec) ":dkim (KEYFILE {:TAG VALUE}*)" @@ -919,8 +928,9 @@ (export '*sshfp-pathname-defaults*) (defvar *sshfp-pathname-defaults* - (make-pathname :directory '(:relative "keys") - :type "sshfp")) + (make-pathname :directory '(:relative "keys") :type "sshfp") + "Default pathname components for SSHFP records.") +(pushnew '*sshfp-pathname-defaults* *zone-config*) (defzoneparse :sshfp (name data rec) ":sshfp { FILENAME | ((FPR :alg ALG :type HASH)*) }" -- 2.11.0