password returns either the configured password, or reads it from the configured file (if possible).
()
| 563 | |
| 564 | // password returns either the configured password, or reads it from the configured file (if possible). |
| 565 | func (s *SMTPHandler) password() (string, error) { |
| 566 | file := s.cfg.Auth.PasswordFile.String() |
| 567 | if len(file) > 0 { |
| 568 | content, err := os.ReadFile(file) |
| 569 | if err != nil { |
| 570 | return "", xerrors.Errorf("could not read %s: %w", file, err) |
| 571 | } |
| 572 | return string(content), nil |
| 573 | } |
| 574 | return s.cfg.Auth.Password.String(), nil |
| 575 | } |