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/file-sharing.scm | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'gnu/services/file-sharing.scm') diff --git a/gnu/services/file-sharing.scm b/gnu/services/file-sharing.scm index e3d681b08f..e32d1f145d 100644 --- a/gnu/services/file-sharing.scm +++ b/gnu/services/file-sharing.scm @@ -115,8 +115,7 @@ (define-maybe string) (set! serialize-maybe-string (lambda (field-name val) (serialize-string field-name - (if (and (symbol? val) - (eq? val 'disabled)) + (if (unspecified? val) "" val)))) @@ -181,8 +180,7 @@ (define (serialize-file-object field-name val) (define-maybe file-object) (set! serialize-maybe-file-object (lambda (field-name val) - (if (and (symbol? val) - (eq? val 'disabled)) + (if (unspecified? val) (serialize-string field-name "") (serialize-file-object field-name val)))) @@ -281,7 +279,7 @@ (define-configuration transmission-daemon-configuration torrent is complete. Otherwise, files for all torrents (including those still being downloaded) will be placed in @code{download-dir}.") (incomplete-dir - (maybe-string 'disabled) + maybe-string "The directory in which files from incompletely downloaded torrents will be held when @code{incomplete-dir-enabled?} is @code{#t}.") (umask @@ -305,7 +303,7 @@ (define-configuration transmission-daemon-configuration automatically (and the original files removed, if @code{trash-original-torrent-files?} is @code{#t}).") (watch-dir - (maybe-string 'disabled) + maybe-string "The directory to be watched for @file{.torrent} files indicating new torrents to be added, when @code{watch-dir-enabled} is @code{#t}.") (trash-original-torrent-files? @@ -401,11 +399,11 @@ (define-configuration transmission-daemon-configuration @code{prefer-unencrypted-connections}, @code{prefer-encrypted-connections} or @code{require-encrypted-connections}.") (peer-congestion-algorithm - (maybe-string 'disabled) + maybe-string "The TCP congestion-control algorithm to use for peer connections, specified using a string recognized by the operating system in calls to -@code{setsockopt} (or set to @code{disabled}, in which case the -operating-system default is used). +@code{setsockopt} (or leave it unset, in which case the operating-system +default is used). Note that on GNU/Linux systems, the kernel must be configured to allow processes to use a congestion-control algorithm not in the default set; @@ -465,7 +463,7 @@ (define-configuration transmission-daemon-configuration "When @code{#t}, the daemon will ignore peers mentioned in the blocklist it has most recently downloaded from @code{blocklist-url}.") (blocklist-url - (maybe-string 'disabled) + maybe-string "The URL of a peer blocklist (in @acronym{P2P}-plaintext or eMule @file{.dat} format) to be periodically downloaded and applied when @code{blocklist-enabled?} is @code{#t}.") @@ -564,11 +562,11 @@ (define-configuration transmission-daemon-configuration the side effect of disabling host-name whitelisting (see @code{rpc-host-whitelist-enabled?}.") (rpc-username - (maybe-string 'disabled) + maybe-string "The username required by clients to access the @acronym{RPC} interface when @code{rpc-authentication-required?} is @code{#t}.") (rpc-password - (maybe-transmission-password-hash 'disabled) + maybe-transmission-password-hash "The password required by clients to access the @acronym{RPC} interface when @code{rpc-authentication-required?} is @code{#t}. This must be specified using a password hash in the format recognized by Transmission clients, either @@ -613,7 +611,7 @@ (define-configuration transmission-daemon-configuration @code{script-torrent-done-filename} will be invoked each time a torrent completes.") (script-torrent-done-filename - (maybe-file-object 'disabled) + maybe-file-object "A file name or file-like object specifying a script to run each time a torrent completes, when @code{script-torrent-done-enabled?} is @code{#t}.") (scrape-paused-torrents-enabled? -- cgit v1.2.3