imapnotify: enable STARTTLS if enabled in email account config (#5013)

* imapnotify: enable STARTTLS if enabled in email account config

Since version 2.3.10 goimapnotify supports starttls. In version 2.3.11 a
typo in the settings was fixed, using tlsOptions.starttls to enable it.

This commit enables starttls in the goimapnotify config file if it is
enabled in the email account's imap settings.

* imapnotify: test generated config file

Compare the generated service config file with a manually verified
sample.
This commit is contained in:
Rafael Carvalho 2024-02-10 22:01:01 +00:00 committed by GitHub
parent 4c0357ff87
commit fb0196ad9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 0 deletions

View File

@ -72,6 +72,7 @@ let
inherit (account.imap) host;
inherit port;
tls = account.imap.tls.enable;
tlsOptions.starttls = account.imap.tls.useStartTls;
username = account.userName;
passwordCmd =
lib.concatMapStringsSep " " lib.escapeShellArg account.passwordCommand;

View File

@ -0,0 +1 @@
{"boxes":["Inbox"],"host":"imap.example.com","onNewMail":"@notmuch@/bin/notmuch new\n","passwordCmd":"'password-command'","port":993,"tls":true,"tlsOptions":{"starttls":false},"username":"home.manager"}

View File

@ -35,5 +35,10 @@ with lib;
serviceFileNormalized="$(normalizeStorePaths "$serviceFile")"
assertFileExists $serviceFile
assertFileContent $serviceFileNormalized ${./imapnotify.service}
configFile="home-files/.config/imapnotify/imapnotify-hm-example.com-config.json"
configFileNormalized="$(normalizeStorePaths "$configFile")"
assertFileExists $configFile
assertFileContent $configFileNormalized ${./imapnotify-config.json}
'';
}