1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2026-02-27 20:55:55 +00:00

Inversion of Control for smtpd.Server

Allow more control over how Server is instaniated so that it can be unit
tested.
This commit is contained in:
James Hillyerd
2013-10-29 10:27:55 -07:00
parent ea6bb44969
commit 5ccd6b2044
2 changed files with 5 additions and 4 deletions

View File

@@ -46,9 +46,7 @@ var expErrorsHist = new(expvar.String)
var expWarnsHist = new(expvar.String)
// Init a new Server object
func New() *Server {
ds := DefaultFileDataStore()
cfg := config.GetSmtpConfig()
func NewSmtpServer(cfg config.SmtpConfig, ds DataStore) *Server {
return &Server{dataStore: ds, domain: cfg.Domain, maxRecips: cfg.MaxRecipients,
maxIdleSeconds: cfg.MaxIdleSeconds, maxMessageBytes: cfg.MaxMessageBytes,
storeMessages: cfg.StoreMessages, domainNoStore: strings.ToLower(cfg.DomainNoStore),