From 8cb1a49a3998c39f315a4199b7d4a121a6d66449 Mon Sep 17 00:00:00 2001 From: Attila Lendvai Date: Tue, 17 May 2022 13:39:28 +0200 Subject: services: configuration: Use *unspecified* instead of 'disabled. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use *unspecified* as a marker for field values that have not been set. Rationale: 'disabled may easily clash with user values for boolean fields, is confusing (i.e. its meaning is *not* boolean false, but unspecified) and it also passes silently through the symbol? predicate of a field of type symbol. * gnu/services/configuration.scm (configuration-missing-default-value): Renamed from configuration-no-default-value. (define-maybe-helper): Use *unspecified* instead of 'disabled, and make the default value optional. * gnu/home/services/desktop.scm (home-redshift-configuration): Change (maybe-xyz 'disabled) to maybe-xyz. * gnu/services/authentication.scm (nslcd-configuration): Likewise. * gnu/services/cgit.scm (repository-cgit-configuration): Likewise. * gnu/services/file-sharing.scm (serialize-maybe-string) (serialize-maybe-file-object): Use 'unspecified?' instead of (eq? val 'disabled). * gnu/services/messaging.scm (raw-content?): Likewise. (ssl-configuration): Change (maybe-xyz 'disabled) to maybe-xyz. (prosody-configuration): Likewise. * gnu/services/file-sharing.scm (transmission-daemon-configuration): Likewise. * gnu/services/messaging.scm (define-all-configurations): Use *unspecified* instead of 'disabled'. * gnu/services/networking.scm (opendht-configuration): Likewise. * gnu/services/pm.scm (tlp-configuration): Likewise. * gnu/services/telephony.scm (jami-account): Likewise. (jami-configuration): Likewise. * gnu/services/vpn.scm (openvpn-client-configuration): Likewise. * tests/services/configuration.scm ("maybe type, no default") ("maybe type, with default"): New tests. Signed-off-by: Ludovic Courtès --- gnu/services/messaging.scm | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'gnu/services/messaging.scm') diff --git a/gnu/services/messaging.scm b/gnu/services/messaging.scm index 48eff27b49..651f90adb2 100644 --- a/gnu/services/messaging.scm +++ b/gnu/services/messaging.scm @@ -76,6 +76,7 @@ (define (make-pred arg) (lambda (field target) (and (memq (syntax->datum target) `(common ,arg)) field))) (syntax-case stx () + ;; TODO Also handle (field-type) form, without a default. ((_ stem (field (field-type def) doc target) ...) (with-syntax (((new-field-type ...) (map (lambda (field-type target) @@ -89,7 +90,7 @@ (define (make-pred arg) ((new-def ...) (map (lambda (def target) (if (eq? 'common (syntax->datum target)) - #''disabled def)) + #'*unspecified* def)) #'(def ...) #'(target ...))) ((new-doc ...) (map (lambda (doc target) @@ -199,7 +200,7 @@ (define (serialize-file-object-list field-name val) (define-maybe file-object-list) (define (raw-content? val) - (not (eq? val 'disabled))) + (not (unspecified? val))) (define (serialize-raw-content field-name val) val) (define-maybe raw-content) @@ -227,15 +228,15 @@ (define-maybe mod-muc-configuration) (define-configuration ssl-configuration (protocol - (maybe-string 'disabled) + maybe-string "This determines what handshake to use.") (key - (maybe-file-name 'disabled) + maybe-file-name "Path to your private key file.") (certificate - (maybe-file-name 'disabled) + maybe-file-name "Path to your certificate file.") (capath @@ -244,48 +245,48 @@ (define-configuration ssl-configuration trust when verifying the certificates of remote servers.") (cafile - (maybe-file-object 'disabled) + maybe-file-object "Path to a file containing root certificates that you wish Prosody to trust. Similar to @code{capath} but with all certificates concatenated together.") (verify - (maybe-string-list 'disabled) + maybe-string-list "A list of verification options (these mostly map to OpenSSL's @code{set_verify()} flags).") (options - (maybe-string-list 'disabled) + maybe-string-list "A list of general options relating to SSL/TLS. These map to OpenSSL's @code{set_options()}. For a full list of options available in LuaSec, see the LuaSec source.") (depth - (maybe-non-negative-integer 'disabled) + maybe-non-negative-integer "How long a chain of certificate authorities to check when looking for a trusted root certificate.") (ciphers - (maybe-string 'disabled) + maybe-string "An OpenSSL cipher string. This selects what ciphers Prosody will offer to clients, and in what order.") (dhparam - (maybe-file-name 'disabled) + maybe-file-name "A path to a file containing parameters for Diffie-Hellman key exchange. You can create such a file with: @code{openssl dhparam -out /etc/prosody/certs/dh-2048.pem 2048}") (curve - (maybe-string 'disabled) + maybe-string "Curve for Elliptic curve Diffie-Hellman. Prosody's default is @samp{\"secp384r1\"}.") (verifyext - (maybe-string-list 'disabled) + maybe-string-list "A list of \"extra\" verification options.") (password - (maybe-string 'disabled) + maybe-string "Password for encrypted private keys.")) (define (serialize-ssl-configuration field-name val) #~(format #f "ssl = {\n~a};\n" @@ -473,12 +474,12 @@ (define-all-configurations prosody-configuration global) (http-max-content-size - (maybe-non-negative-integer 'disabled) + (maybe-non-negative-integer *unspecified*) "Maximum allowed size of the HTTP body (in bytes)." common) (http-external-url - (maybe-string 'disabled) + (maybe-string *unspecified*) "Some modules expose their own URL in various ways. This URL is built from the protocol, host and port used. If Prosody sits behind a proxy, the public URL will be @code{http-external-url} instead. See @@ -555,7 +556,7 @@ (define-all-configurations prosody-configuration int-component) (mod-muc - (maybe-mod-muc-configuration 'disabled) + (maybe-mod-muc-configuration *unspecified*) "Multi-user chat (MUC) is Prosody's module for allowing you to create hosted chatrooms/conferences for XMPP users. @@ -572,7 +573,7 @@ (define-all-configurations prosody-configuration ext-component) (raw-content - (maybe-raw-content 'disabled) + (maybe-raw-content *unspecified*) "Raw content that will be added to the configuration file." common))) -- cgit v1.2.3