Remove gotcha (fix #42)

This commit is contained in:
Ian Kent 2015-04-19 18:06:05 +01:00
parent f4a8a8c8eb
commit 320a41fcd9
2 changed files with 32 additions and 11 deletions

View file

@ -1,3 +1,5 @@
VERSION=0.1.7
all: deps fmt combined all: deps fmt combined
combined: combined:
@ -14,7 +16,6 @@ deps:
go get github.com/mailhog/MailHog-UI go get github.com/mailhog/MailHog-UI
cd ../MailHog-UI; make bindata cd ../MailHog-UI; make bindata
go get github.com/mailhog/http go get github.com/mailhog/http
go get github.com/ian-kent/gotcha/gotcha
go get github.com/ian-kent/go-log/log go get github.com/ian-kent/go-log/log
go get github.com/ian-kent/envconf go get github.com/ian-kent/envconf
go get github.com/ian-kent/goose go get github.com/ian-kent/goose
@ -31,4 +32,22 @@ test-deps:
release-deps: release-deps:
go get github.com/mitchellh/gox go get github.com/mitchellh/gox
pull:
git pull
cd ../data; git pull
cd ../http; git pull
cd ../MailHog-Server; git pull
cd ../MailHog-UI; git pull
cd ../smtp; git pull
cd ../storage; git pull
tag:
git tag -a -m 'v${VERSION}' ${VERSION} && git push origin ${VERSION}
cd ../data; git tag -a -m 'v${VERSION}' ${VERSION} && git push origin ${VERSION}
cd ../http; git tag -a -m 'v${VERSION}' ${VERSION} && git push origin ${VERSION}
cd ../MailHog-Server; git tag -a -m 'v${VERSION}' ${VERSION} && git push origin ${VERSION}
cd ../MailHog-UI; git tag -a -m 'v${VERSION}' ${VERSION} && git push origin ${VERSION}
cd ../smtp; git tag -a -m 'v${VERSION}' ${VERSION} && git push origin ${VERSION}
cd ../storage; git tag -a -m 'v${VERSION}' ${VERSION} && git push origin ${VERSION}
.PNONY: all combined release fmt deps test-deps release-deps .PNONY: all combined release fmt deps test-deps release-deps

22
main.go
View file

@ -4,8 +4,10 @@ import (
"flag" "flag"
"os" "os"
gohttp "net/http"
"github.com/gorilla/pat"
"github.com/ian-kent/go-log/log" "github.com/ian-kent/go-log/log"
gotcha "github.com/ian-kent/gotcha/app"
"github.com/mailhog/MailHog-Server/api" "github.com/mailhog/MailHog-Server/api"
cfgapi "github.com/mailhog/MailHog-Server/config" cfgapi "github.com/mailhog/MailHog-Server/config"
"github.com/mailhog/MailHog-Server/smtp" "github.com/mailhog/MailHog-Server/smtp"
@ -32,19 +34,19 @@ func main() {
exitCh = make(chan int) exitCh = make(chan int)
if uiconf.UIBindAddr == apiconf.APIBindAddr { if uiconf.UIBindAddr == apiconf.APIBindAddr {
cb := func(app *gotcha.App) { cb := func(r gohttp.Handler) {
web.CreateWeb(uiconf, app) web.CreateWeb(uiconf, r.(*pat.Router), assets.Asset)
api.CreateAPIv1(apiconf, app) api.CreateAPIv1(apiconf, r.(*pat.Router))
api.CreateAPIv2(apiconf, app) api.CreateAPIv2(apiconf, r.(*pat.Router))
} }
go http.Listen(uiconf.UIBindAddr, assets.Asset, exitCh, cb) go http.Listen(uiconf.UIBindAddr, assets.Asset, exitCh, cb)
} else { } else {
cb1 := func(app *gotcha.App) { cb1 := func(r gohttp.Handler) {
api.CreateAPIv1(apiconf, app) api.CreateAPIv1(apiconf, r.(*pat.Router))
api.CreateAPIv2(apiconf, app) api.CreateAPIv2(apiconf, r.(*pat.Router))
} }
cb2 := func(app *gotcha.App) { cb2 := func(r gohttp.Handler) {
web.CreateWeb(uiconf, app) web.CreateWeb(uiconf, r.(*pat.Router), assets.Asset)
} }
go http.Listen(apiconf.APIBindAddr, assets.Asset, exitCh, cb1) go http.Listen(apiconf.APIBindAddr, assets.Asset, exitCh, cb1)
go http.Listen(uiconf.UIBindAddr, assets.Asset, exitCh, cb2) go http.Listen(uiconf.UIBindAddr, assets.Asset, exitCh, cb2)