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/telephony.scm | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'gnu/services/telephony.scm') diff --git a/gnu/services/telephony.scm b/gnu/services/telephony.scm index 0a11e283a0..e8bfbc88c5 100644 --- a/gnu/services/telephony.scm +++ b/gnu/services/telephony.scm @@ -157,7 +157,7 @@ (define-configuration jami-account secret key material of the Jami account it contains." empty-serializer) (allowed-contacts - (maybe-account-fingerprint-list 'disabled) + maybe-account-fingerprint-list "The list of allowed contacts for the account, entered as their 40 characters long fingerprint. Messages or calls from accounts not in that list will be rejected. When unspecified, the configuration of the account archive @@ -166,7 +166,7 @@ (define-configuration jami-account the account." empty-serializer) (moderators - (maybe-account-fingerprint-list 'disabled) + maybe-account-fingerprint-list "The list of contacts that should have moderation privileges (to ban, mute, etc. other users) in rendezvous conferences, entered as their 40 characters long fingerprint. When unspecified, the configuration of the account archive @@ -175,24 +175,24 @@ (define-configuration jami-account empty-serializer) ;; The serializable fields below are to be set with set-account-details. (rendezvous-point? - (maybe-boolean 'disabled) + maybe-boolean "Whether the account should operate in the rendezvous mode. In this mode, all the incoming audio/video calls are mixed into a conference. When left unspecified, the value from the account archive prevails.") (peer-discovery? - (maybe-boolean 'disabled) + maybe-boolean "Whether peer discovery should be enabled. Peer discovery is used to discover other OpenDHT nodes on the local network, which can be useful to maintain communication between devices on such network even when the connection to the the Internet has been lost. When left unspecified, the value from the account archive prevails.") (bootstrap-hostnames - (maybe-string-list 'disabled) + maybe-string-list "A list of hostnames or IPs pointing to OpenDHT nodes, that should be used to initially join the OpenDHT network. When left unspecified, the value from the account archive prevails.") (name-server-uri - (maybe-string 'disabled) + maybe-string "The URI of the name server to use, that can be used to retrieve the account fingerprint for a registered username.")) @@ -214,7 +214,7 @@ (define (field-name->account-detail name) name ((configuration-field-getter field) jami-account-object))) ;; The define-maybe default serializer produces an - ;; empty string for the 'disabled value. + ;; empty string for unspecified values. (value* (if (string-null? value) #f value))) @@ -247,7 +247,7 @@ (define-configuration/no-serialization jami-configuration (boolean #f) "Whether to force automatic answer to incoming calls.") (accounts - (maybe-jami-account-list 'disabled) + maybe-jami-account-list "A list of Jami accounts to be (re-)provisioned every time the Jami daemon service starts. When providing this field, the account directories under @file{/var/lib/jami/} are recreated every time the service starts, ensuring a @@ -307,7 +307,7 @@ (define (jami-shepherd-services config) (dbus (jami-configuration-dbus config)) (dbus-daemon (file-append dbus "/bin/dbus-daemon")) (accounts (jami-configuration-accounts config)) - (declarative-mode? (not (eq? 'disabled accounts)))) + (declarative-mode? (not (unspecified? accounts)))) (with-extensions (list guile-packrat ;used by guile-ac-d-bus guile-ac-d-bus @@ -649,7 +649,7 @@ (define (archive-name->username archive) account-details) (let ((username (archive-name->username archive))) - (when (not (eq? 'disabled allowed-contacts)) + (when (not (unspecified? allowed-contacts)) ;; Reject calls from unknown contacts. (set-account-details '(("DHT.PublicInCalls" . "false")) username) @@ -659,7 +659,7 @@ (define (archive-name->username archive) ;; Add allowed ones. (for-each (cut add-contact <> username) allowed-contacts)) - (when (not (eq? 'disabled moderators)) + (when (not (unspecified? moderators)) ;; Disable the 'AllModerators' property. (set-all-moderators #f username) ;; Remove all moderators. -- cgit v1.2.3