Skip to content

Commit e1f6a88

Browse files
committed
Add HTTP authentication for mailhog/MailHog#40
1 parent fec2db1 commit e1f6a88

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

main.go

+8
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,29 @@ import (
1212
"github.com/mailhog/MailHog-Server/config"
1313
"github.com/mailhog/MailHog-Server/smtp"
1414
"github.com/mailhog/MailHog-UI/assets"
15+
comcfg "github.com/mailhog/MailHog/config"
1516
"github.com/mailhog/http"
1617
)
1718

1819
var conf *config.Config
20+
var comconf *comcfg.Config
1921
var exitCh chan int
2022

2123
func configure() {
24+
comcfg.RegisterFlags()
2225
config.RegisterFlags()
2326
flag.Parse()
2427
conf = config.Configure()
28+
comconf = comcfg.Configure()
2529
}
2630

2731
func main() {
2832
configure()
2933

34+
if comconf.AuthFile != "" {
35+
http.AuthFile(comconf.AuthFile)
36+
}
37+
3038
exitCh = make(chan int)
3139
cb := func(r gohttp.Handler) {
3240
api.CreateAPIv1(conf, r.(*pat.Router))

0 commit comments

Comments
 (0)