1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 17:47:03 +00:00
Files
go-inbucket/app/controllers/app.go
James Hillyerd 9fa93acf0e Modify smtpd to integrate with Revel.
Add plugin to app.go to start smtpd
2012-10-07 19:12:58 -07:00

32 lines
625 B
Go

package controllers
import (
"github.com/jhillyerd/inbucket/app/smtpd"
"github.com/robfig/revel"
)
type Application struct {
*rev.Controller
}
func (c Application) Index() rev.Result {
return c.Render()
}
type SmtpdPlugin struct {
rev.EmptyPlugin
server *smtpd.Server
}
func (p SmtpdPlugin) OnAppStart() {
domain := rev.Config.StringDefault("smtpd.domain", "localhost")
port := rev.Config.IntDefault("smtpd.port", 2500)
rev.INFO.Printf("SMTP Daemon plugin init {domain: %v, port: %v}", domain, port)
p.server = smtpd.New(domain, port)
go p.server.Start()
}
func init() {
rev.RegisterPlugin(SmtpdPlugin{})
}