Fix email config not reading from env vars
Viper requires SetDefault to be called for env vars to be automatically bound. Added defaults for EMAIL_HOST_USER and EMAIL_HOST_PASSWORD. Also added info logging to show email config on startup for debugging. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -75,13 +75,22 @@ func main() {
|
||||
|
||||
// Initialize email service
|
||||
var emailService *services.EmailService
|
||||
log.Info().
|
||||
Str("email_host", cfg.Email.Host).
|
||||
Str("email_user", cfg.Email.User).
|
||||
Str("email_from", cfg.Email.From).
|
||||
Int("email_port", cfg.Email.Port).
|
||||
Msg("Email config loaded")
|
||||
if cfg.Email.Host != "" && cfg.Email.User != "" {
|
||||
emailService = services.NewEmailService(&cfg.Email)
|
||||
log.Info().
|
||||
Str("host", cfg.Email.Host).
|
||||
Msg("Email service initialized")
|
||||
} else {
|
||||
log.Warn().Msg("Email service not configured - emails will not be sent")
|
||||
log.Warn().
|
||||
Str("host", cfg.Email.Host).
|
||||
Str("user", cfg.Email.User).
|
||||
Msg("Email service not configured - emails will not be sent")
|
||||
}
|
||||
|
||||
// Setup router with dependencies
|
||||
|
||||
Reference in New Issue
Block a user