From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:55111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHb3H-0001My-9l for guix-patches@gnu.org; Fri, 19 Apr 2019 17:28:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hHb3F-0006E2-By for guix-patches@gnu.org; Fri, 19 Apr 2019 17:28:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59504) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hHb3C-0006DV-EZ for guix-patches@gnu.org; Fri, 19 Apr 2019 17:28:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hHb3C-00015z-4G for guix-patches@gnu.org; Fri, 19 Apr 2019 17:28:02 -0400 Subject: [bug#35329] [PATCH] gnu: knot-service: Add includes field in configuration. Resent-Message-ID: Received: from eggs.gnu.org ([209.51.188.92]:54540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHb2J-0000a0-W4 for guix-patches@gnu.org; Fri, 19 Apr 2019 17:27:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hHayZ-0003OZ-Qf for guix-patches@gnu.org; Fri, 19 Apr 2019 17:23:16 -0400 Received: from lepiller.eu ([89.234.186.109]:39870) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hHayZ-0003Mr-H5 for guix-patches@gnu.org; Fri, 19 Apr 2019 17:23:15 -0400 Received: from localhost.localdomain (89-92-10-229.hfc.dyn.abo.bbox.fr [89.92.10.229]) by lepiller.eu (OpenSMTPD) with ESMTPSA id 25ace2da (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Fri, 19 Apr 2019 21:23:09 +0000 (UTC) From: Julien Lepiller Date: Fri, 19 Apr 2019 23:22:55 +0200 Message-Id: <20190419212255.20209-1-julien@lepiller.eu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 35329@debbugs.gnu.org * gnu/services/dns.scm (knot-configuration): Add includes field. (verify-knot-configuration): Check includes content. (knot-config-file): Serialize includes. * doc/guix.texi (DNS Services): Document it. --- doc/guix.texi | 7 +++++++ gnu/services/dns.scm | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 8c7522f286..d61fd1c7a9 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19814,6 +19814,13 @@ The Knot package. @item @code{run-directory} (default: @code{"/var/run/knot"}) The run directory. This directory will be used for pid file and sockets. +@item @code{includes} (default: @code{'()}) +A list of strings or file-like objects denoting other files that must be +included at the top of the configuration file. This is especially useful +for including key configuration from outside the store, since keys should +not be readable by every user. It can also be used to add configuration +not supported by this interface. + @item @code{listen-v4} (default: @code{"0.0.0.0"}) An ip address on which to listen. diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm index 1ef754b360..445e03570a 100644 --- a/gnu/services/dns.scm +++ b/gnu/services/dns.scm @@ -207,6 +207,8 @@ (default knot)) (run-directory knot-configuration-run-directory (default "/var/run/knot")) + (includes knot-configuration-includes + (default '())) (listen-v4 knot-configuration-listen-v4 (default "0.0.0.0")) (listen-v6 knot-configuration-listen-v6 @@ -296,6 +298,8 @@ (error-out "knot configuration field must be a package.")) (unless (string? (knot-configuration-run-directory config)) (error-out "run-directory must be a string.")) + (unless (list? (knot-configuration-includes config)) + (error-out "includes must be a list of strings or file-like objects.")) (unless (list? (knot-configuration-keys config)) (error-out "keys must be a list of knot-key-configuration.")) (for-each (lambda (key) (verify-knot-key-configuration key)) @@ -529,6 +533,10 @@ #~(begin (call-with-output-file #$output (lambda (port) + (if (knot-configuration-includes config) + (for-each (lambda (inc) + (format port "include: ~a\n" inc)) + (knot-configuration-includes config))) (format port "server:\n") (format port " rundir: ~a\n" #$(knot-configuration-run-directory config)) (format port " user: knot\n") -- 2.21.0