summaryrefslogtreecommitdiff
path: root/gnu/services/configuration.scm
diff options
context:
space:
mode:
authorClément Lassieur <clement@lassieur.org>2018-02-26 01:12:24 +0100
committerClément Lassieur <clement@lassieur.org>2018-03-03 18:21:52 +0100
commitbdcf0e6fd484a54240a98ddf8b6fa433c1b9bd6c (patch)
tree3c7acf5035bd18b09b7c535ed64385af057e1c30 /gnu/services/configuration.scm
parentfb547c3429c32081d68f6f78d7fdfc95a4851348 (diff)
downloadpatches-bdcf0e6fd484a54240a98ddf8b6fa433c1b9bd6c.tar
patches-bdcf0e6fd484a54240a98ddf8b6fa433c1b9bd6c.tar.gz
services: messaging: Prosody config supports file-like objects.
* doc/guix.texi (Messaging Services): Update accordingly. * gnu/services/configuration.scm (serialize-configuration, serialize-maybe-stem, serialize-package): Return strings or string-valued gexps (these procedures were only used for their side-effects). * gnu/services/messaging.scm (serialize-field, serialize-field-list, enclose-quotes, serialize-raw-content, serialize-ssl-configuration, serialize-virtualhost-configuration-list, serialize-int-component-configuration-list, serialize-ext-component-configuration-list, serialize-virtualhost-configuration, serialize-int-component-configuration, serialize-ext-component-configuration, serialize-prosody-configuration): Return strings or string-valued gexps and stop printing. (prosody-activation): Use SERIALIZE-PROSODY-CONFIGURATION's return value with MIXED-TEXT-FILE instead of using its output with PLAIN-FILE. (serialize-non-negative-integer, serialize-non-negative-integer-list): Convert numbers to strings. (file-object?, serialize-file-object, file-object-list?, serialize-file-object-list): New procedures. (ssl-configuration)[capath, cafile], (prosody-configuration)[plugin-paths, groups-file]: Replace FILE-NAME with FILE-OBJECT. * guix/gexp.scm (file-like?): New exported procedure.
Diffstat (limited to 'gnu/services/configuration.scm')
-rw-r--r--gnu/services/configuration.scm17
1 files changed, 9 insertions, 8 deletions
diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index c45340f02f..707944cbe0 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -1,7 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
-;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
+;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -74,11 +74,12 @@
(documentation configuration-field-documentation))
(define (serialize-configuration config fields)
- (for-each (lambda (field)
- ((configuration-field-serializer field)
- (configuration-field-name field)
- ((configuration-field-getter field) config)))
- fields))
+ #~(string-append
+ #$@(map (lambda (field)
+ ((configuration-field-serializer field)
+ (configuration-field-name field)
+ ((configuration-field-getter field) config)))
+ fields)))
(define (validate-configuration config fields)
(for-each (lambda (field)
@@ -105,7 +106,7 @@
(define (maybe-stem? val)
(or (eq? val 'disabled) (stem? val)))
(define (serialize-maybe-stem field-name val)
- (when (stem? val) (serialize-stem field-name val)))))))))
+ (if (stem? val) (serialize-stem field-name val) ""))))))))
(define-syntax define-configuration
(lambda (stx)
@@ -147,7 +148,7 @@
conf))))))))
(define (serialize-package field-name val)
- #f)
+ "")
;; A little helper to make it easier to document all those fields.
(define (generate-documentation documentation documentation-name)