@@ -26,10 +26,13 @@ import (
2626 smtpbackend "github.com/emersion/hydroxide/smtp"
2727)
2828
29+ var debug bool
30+
2931func newClient () * protonmail.Client {
3032 return & protonmail.Client {
3133 RootURL : "https://mail.protonmail.com/api" ,
3234 AppVersion : "Web_3.16.6" ,
35+ Debug : debug ,
3336 }
3437}
3538
@@ -134,7 +137,7 @@ Flags:
134137 CardDAV port on which hydroxide listens, defaults to 8080`
135138
136139func main () {
137- debug := flag .Bool ( "debug" , false , "Enable debug logs" )
140+ flag .BoolVar ( & debug , "debug" , false , "Enable debug logs" )
138141
139142 smtpHost := flag .String ("smtp-host" , "127.0.0.1" , "Allowed SMTP email hostname on which hydroxide listens, defaults to 127.0.0.1" )
140143 smtpPort := flag .String ("smtp-port" , "1025" , "SMTP port on which hydroxide listens, defaults to 1025" )
@@ -335,12 +338,12 @@ func main() {
335338 case "smtp" :
336339 addr := * smtpHost + ":" + * smtpPort
337340 authManager := auth .NewManager (newClient )
338- log .Fatal (listenAndServeSMTP (addr , * debug , authManager ))
341+ log .Fatal (listenAndServeSMTP (addr , debug , authManager ))
339342 case "imap" :
340343 addr := * imapHost + ":" + * imapPort
341344 authManager := auth .NewManager (newClient )
342345 eventsManager := events .NewManager ()
343- log .Fatal (listenAndServeIMAP (addr , * debug , authManager , eventsManager ))
346+ log .Fatal (listenAndServeIMAP (addr , debug , authManager , eventsManager ))
344347 case "carddav" :
345348 addr := * carddavHost + ":" + * carddavPort
346349 authManager := auth .NewManager (newClient )
@@ -356,10 +359,10 @@ func main() {
356359
357360 done := make (chan error , 3 )
358361 go func () {
359- done <- listenAndServeSMTP (smtpAddr , * debug , authManager )
362+ done <- listenAndServeSMTP (smtpAddr , debug , authManager )
360363 }()
361364 go func () {
362- done <- listenAndServeIMAP (imapAddr , * debug , authManager , eventsManager )
365+ done <- listenAndServeIMAP (imapAddr , debug , authManager , eventsManager )
363366 }()
364367 go func () {
365368 done <- listenAndServeCardDAV (carddavAddr , authManager , eventsManager )
0 commit comments