MailHog/MailHog-UI/main.go

43 lines
753 B
Go
Raw Normal View History

2014-04-16 22:29:23 +00:00
package main
import (
"flag"
2014-10-29 16:59:59 +00:00
"os"
2014-11-23 15:05:11 +00:00
"github.com/ian-kent/Go-MailHog/MailHog-Server/config"
"github.com/ian-kent/Go-MailHog/MailHog-UI/assets"
"github.com/ian-kent/Go-MailHog/MailHog-UI/http/web"
"github.com/ian-kent/Go-MailHog/http"
"github.com/ian-kent/go-log/log"
gotcha "github.com/ian-kent/gotcha/app"
2014-04-16 22:29:23 +00:00
)
2014-04-23 23:22:50 +00:00
var conf *config.Config
2014-04-20 14:35:59 +00:00
var exitCh chan int
2014-04-16 22:29:23 +00:00
2014-04-23 23:22:50 +00:00
func configure() {
2014-11-23 15:05:11 +00:00
config.RegisterFlags()
2014-04-16 22:29:23 +00:00
flag.Parse()
2014-11-23 15:05:11 +00:00
conf = config.Configure()
2014-04-16 22:29:23 +00:00
}
func main() {
2014-04-23 23:22:50 +00:00
configure()
2014-04-16 22:29:23 +00:00
2014-11-23 15:05:11 +00:00
// FIXME need to make API URL configurable
2014-04-20 14:35:59 +00:00
exitCh = make(chan int)
2014-11-23 15:05:11 +00:00
cb := func(app *gotcha.App) {
web.CreateWeb(conf, app)
}
go http.Listen(conf, assets.Asset, exitCh, cb)
2014-04-20 14:35:59 +00:00
for {
select {
case <-exitCh:
log.Printf("Received exit signal")
os.Exit(0)
2014-04-20 14:35:59 +00:00
}
}
}