mirror of
https://gitlab.com/ric_harvey/MailHog.git
synced 2024-11-23 22:34:04 +00:00
Clean up flags
This commit is contained in:
parent
91c92f4d02
commit
7fd0638ae4
2 changed files with 34 additions and 14 deletions
|
@ -3,13 +3,22 @@ Configuring MailHog
|
|||
|
||||
You can configure MailHog using command line options or environment variables:
|
||||
|
||||
| Environment | Command line | Default | Description
|
||||
| ------------------- | ------------- | --------------- | -----------
|
||||
| MH_CORS_ORIGIN | -cors-origin | | If set, a Access-Control-Allow-Origin header is returned for API endpoints
|
||||
| MH_HOSTNAME | -hostname | mailhog.example | Hostname to use for EHLO/HELO and message IDs
|
||||
| MH_HTTP_BIND_ADDR | -httpbindaddr | 0.0.0.0:8025 | Interface and port for HTTP server to bind to
|
||||
| MH_MONGO_COLLECTION | -mongocoll | messages | MongoDB collection name for message storage
|
||||
| MH_MONGO_DB | -mongodb | mailhog | MongoDB database name for message storage
|
||||
| MH_MONGO_URI | -mongouri | 127.0.0.1:27017 | MongoDB host and port
|
||||
| MH_SMTP_BIND_ADDR | -smtpbindaddr | 0.0.0.0:1025 | Interface and port for SMTP server to bind to
|
||||
| MH_STORAGE | -storage | memory | Set message storage: memory / mongodb
|
||||
| Environment | Command line | Default | Description
|
||||
| ------------------- | --------------- | --------------- | -----------
|
||||
| MH_CORS_ORIGIN | -cors-origin | | If set, a Access-Control-Allow-Origin header is returned for API endpoints
|
||||
| MH_HOSTNAME | -hostname | mailhog.example | Hostname to use for EHLO/HELO and message IDs
|
||||
| MH_API_BIND_ADDR | -api-bind-addr | 0.0.0.0:8025 | Interface and port for HTTP UI server to bind to
|
||||
| MH_UI_BIND_ADDR | -ui-bind-addr | 0.0.0.0:8025 | Interface and port for HTTP API server to bind to
|
||||
| MH_MONGO_COLLECTION | -mongo-coll | messages | MongoDB collection name for message storage
|
||||
| MH_MONGO_DB | -mongo-db | mailhog | MongoDB database name for message storage
|
||||
| MH_MONGO_URI | -mongo-uri | 127.0.0.1:27017 | MongoDB host and port
|
||||
| MH_SMTP_BIND_ADDR | -smtp-bind-addr | 0.0.0.0:1025 | Interface and port for SMTP server to bind to
|
||||
| MH_STORAGE | -storage | memory | Set message storage: memory / mongodb
|
||||
|
||||
#### Note on HTTP bind addresses
|
||||
|
||||
If `api-bind-addr` and `ui-bind-addr` are identical, a single listener will
|
||||
be used allowing both to co-exist on one port.
|
||||
|
||||
The values must match in a string comparison. Resolving to the same host and
|
||||
port combination isn't enough.
|
||||
|
|
19
main.go
19
main.go
|
@ -31,11 +31,22 @@ func main() {
|
|||
configure()
|
||||
|
||||
exitCh = make(chan int)
|
||||
cb := func(app *gotcha.App) {
|
||||
web.CreateWeb(uiconf, app)
|
||||
api.CreateAPIv1(apiconf, app)
|
||||
if uiconf.UIBindAddr == apiconf.APIBindAddr {
|
||||
cb := func(app *gotcha.App) {
|
||||
web.CreateWeb(uiconf, app)
|
||||
api.CreateAPIv1(apiconf, app)
|
||||
}
|
||||
go http.Listen(uiconf.UIBindAddr, assets.Asset, exitCh, cb)
|
||||
} else {
|
||||
cb1 := func(app *gotcha.App) {
|
||||
api.CreateAPIv1(apiconf, app)
|
||||
}
|
||||
cb2 := func(app *gotcha.App) {
|
||||
web.CreateWeb(uiconf, app)
|
||||
}
|
||||
go http.Listen(apiconf.APIBindAddr, assets.Asset, exitCh, cb1)
|
||||
go http.Listen(uiconf.UIBindAddr, assets.Asset, exitCh, cb2)
|
||||
}
|
||||
go http.Listen(uiconf.HTTPBindAddr, assets.Asset, exitCh, cb)
|
||||
go smtp.Listen(apiconf, exitCh)
|
||||
|
||||
for {
|
||||
|
|
Loading…
Reference in a new issue