mirror of
https://blitiri.com.ar/repos/chasquid
synced 2026-01-07 17:47:14 +00:00
WIP: Add smarthost support
WORK IN PROGRESS -- WORK IN PROGRESS -- WORK IN PROGRESS This patch adds support for delivering mail via a smarthost. In this mode, all accepted mail gets delivered through an SMTP connection to a specific host, statically configured.
This commit is contained in:
@@ -7,6 +7,7 @@ package config
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"blitiri.com.ar/go/log"
|
||||
@@ -127,6 +128,9 @@ func override(c, o *Config) {
|
||||
if o.HaproxyIncoming {
|
||||
c.HaproxyIncoming = true
|
||||
}
|
||||
if o.SmarthostUrl != "" {
|
||||
c.SmarthostUrl = o.SmarthostUrl
|
||||
}
|
||||
}
|
||||
|
||||
// LogConfig logs the given configuration, in a human-friendly way.
|
||||
@@ -154,4 +158,15 @@ func LogConfig(c *Config) {
|
||||
log.Infof(" Dovecot auth: %v (%q, %q)",
|
||||
c.DovecotAuth, c.DovecotUserdbPath, c.DovecotClientPath)
|
||||
log.Infof(" HAProxy incoming: %v", c.HaproxyIncoming)
|
||||
|
||||
// Avoid logging the password for the smarthost URL.
|
||||
smurl, err := url.Parse(c.SmarthostUrl)
|
||||
if err == nil {
|
||||
if smurl.User != nil {
|
||||
smurl.User = url.User(smurl.User.Username())
|
||||
}
|
||||
log.Infof(" Smarthost: %s", smurl)
|
||||
} else {
|
||||
log.Infof(" Smarthost: <invalid URL>")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user