diff --git a/cmd/trello2mail/main.go b/cmd/trello2mail/main.go index 60955eb..e35264e 100644 --- a/cmd/trello2mail/main.go +++ b/cmd/trello2mail/main.go @@ -11,13 +11,21 @@ func main() { // Get task list as markdown trelloCtx := NewTrello(config.TrelloToken) - for _, trelloBoard := range trelloCtx.GetBoards() { + + var trelloBoardsList []TrelloBoard + if len(config.TrelloUrl) > 0 { + trelloBoard := trelloCtx.GetBoard(config.TrelloUrl) + trelloBoardsList = append(trelloBoardsList, trelloBoard) + } else { + trelloBoardsList = trelloCtx.GetBoards() + } + + for _, trelloBoard := range trelloBoardsList { if !trelloBoard.Starred || trelloBoard.Closed { continue } fmt.Printf("Loading board %s\n", trelloBoard.Name) - // trelloBoard := trelloCtx.GetBoard(config.TrelloUrl) trelloMarkdown := trelloBoard.ExportToMarkdown() trelloHtml := trelloBoard.ExportToHtml() config.EmailSubject = fmt.Sprintf("Daily mail for %s", trelloBoard.Name) diff --git a/cmd/trello2mail/transport.go b/cmd/trello2mail/transport.go index 241b7f5..d90cd36 100644 --- a/cmd/trello2mail/transport.go +++ b/cmd/trello2mail/transport.go @@ -50,8 +50,8 @@ func NewTransportAuth(config SmtpConfig) *smtp.Auth { return &auth default: + return nil } - return nil } func NewTransportTls(config SmtpConfig) *tls.Config { @@ -108,6 +108,12 @@ func (ctx *TransportCtx) Dial() { } func (ctx *TransportCtx) Authenticate() { + // guard + if ctx.Auth == nil { + return + } + + // ok, we have to err := ctx.Client.Auth(*ctx.Auth) if err != nil { log.Panic(err)