summary refs log tree commit diff
path: root/gnu/services/file-sharing.scm
diff options
context:
space:
mode:
authorAttila Lendvai <attila@lendvai.name>2022-05-17 13:39:28 +0200
committerLudovic Courtès <ludo@gnu.org>2022-06-15 00:25:21 +0200
commit8cb1a49a3998c39f315a4199b7d4a121a6d66449 (patch)
tree6467f9cb21bc9f60b6f2a2f561d690b5cfdb3b3d /gnu/services/file-sharing.scm
parente11517052b1bbd9fa06891ad0b13b24494db757e (diff)
downloadguix-8cb1a49a3998c39f315a4199b7d4a121a6d66449.tar.gz
services: configuration: Use *unspecified* instead of 'disabled.
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 <ludo@gnu.org>
Diffstat (limited to 'gnu/services/file-sharing.scm')
-rw-r--r--gnu/services/file-sharing.scm24
1 files changed, 11 insertions, 13 deletions
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 @@ type generated and used by Transmission clients, suitable for passing to the
 (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 @@ type generated and used by Transmission clients, suitable for passing to the
 (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 @@ torrent is being downloaded, then moved to @code{download-dir} once the
 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 @@ for new @file{.torrent} files and the torrents they describe added
 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 @@ upstream gateway automatically using @acronym{UPnP} and @acronym{NAT-PMP}.")
 @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 @@ torrent before it is regenerated.")
    "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 @@ which allows remote control of the daemon via its Web interface, the
 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 @@ they are added in ``paused'' state.")
 @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?