Describe the bug
In config/config.go lines 86 and 115, empty IMAPServer and SMTPServer values return empty strings without validation:
func (a *Account) GetIMAPServer() string {
if a.IMAPServer == "" {
return "" // No error
}
return a.IMAPServer
}
Error caught later in fetcher/fetcher.go:236, but better to validate early at config load.
To reproduce
- Create config with empty
imap_server field
- Start matcha
- Connection fails with unclear error downstream
- Should fail fast with clear validation error
Expected behavior
Validate config on load:
func (c *Config) Validate() error {
for _, acc := range c.Accounts {
if acc.IMAPServer == "" {
return fmt.Errorf("account %q: imap_server is required", acc.Email)
}
if acc.SMTPServer == "" {
return fmt.Errorf("account %q: smtp_server is required", acc.Email)
}
}
return nil
}
Screenshots
N/A
Additional context
- File:
config/config.go
- Lines: 86, 115
- Severity: Low-Medium - poor error UX
- Fix complexity: Easy - add validation function
Describe the bug
In
config/config.golines 86 and 115, emptyIMAPServerandSMTPServervalues return empty strings without validation:Error caught later in
fetcher/fetcher.go:236, but better to validate early at config load.To reproduce
imap_serverfieldExpected behavior
Validate config on load:
Screenshots
N/A
Additional context
config/config.go