diff --git a/cmd/api/main.go b/cmd/api/main.go index eb1e248..510a575 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -9,6 +9,7 @@ import ( "gitea.local.lab/Lbenedar/greenlight/internal/data" "gitea.local.lab/Lbenedar/greenlight/internal/jsonlog" + "gitea.local.lab/Lbenedar/greenlight/internal/mailer" _ "github.com/lib/pq" ) @@ -18,6 +19,7 @@ type application struct { config config logger *jsonlog.Logger models data.Models + mailer mailer.Mailer } type config struct { @@ -34,6 +36,13 @@ type config struct { burst int enabled bool } + smtp struct { + host string + port int + username string + password string + sender string + } } func openDB(cfg config) (*sql.DB, error) { @@ -76,6 +85,12 @@ func main() { flag.IntVar(&cfg.limiter.burst, "limiter-burst", 4, "Rate limiter maximum burst") flag.BoolVar(&cfg.limiter.enabled, "limiter-enabled", true, "Enable rate limiter") + flag.StringVar(&cfg.smtp.host, "smtp-host", "smtp.mailtrap.io", "SMTP host") + flag.IntVar(&cfg.smtp.port, "smtp-port", 25, "SMTP port") + flag.StringVar(&cfg.smtp.username, "smtp-username", "0abf276416b183", "SMTP username") + flag.StringVar(&cfg.smtp.password, "smtp-password", "d8672aa2264bb5", "SMTP password") + flag.StringVar(&cfg.smtp.sender, "smtp-sender", "Greenlight