Merge branch 'oers-fork'

This commit is contained in:
Ian Kent 2016-03-13 17:58:28 +00:00
commit 5889b5a508
3 changed files with 13 additions and 0 deletions

View file

@ -14,14 +14,23 @@ func DefaultConfig() *Config {
type Config struct {
AuthFile string
WebPath string
}
var cfg = DefaultConfig()
func Configure() *Config {
//sanitize webpath
//add a leading slash
if cfg.WebPath != "" && !(cfg.WebPath[0] == '/') {
cfg.WebPath = "/" + cfg.WebPath
}
return cfg
}
func RegisterFlags() {
flag.StringVar(&cfg.AuthFile, "auth-file", envconf.FromEnvP("MH_AUTH_FILE", "").(string), "A username:bcryptpw mapping file")
flag.StringVar(&cfg.WebPath, "ui-web-path", envconf.FromEnvP("MH_UI_WEB_PATH", "").(string), "WebPath under which the UI is served (without leading or trailing slashes), e.g. 'mailhog'. Value defaults to ''")
}

View file

@ -15,6 +15,7 @@ You can configure MailHog using command line options or environment variables:
| 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
| MH_OUTGOING_SMTP | -outgoing-smtp | | JSON file defining outgoing SMTP servers
| MH_UI_WEB_PATH | -ui-web-path | | WebPath under which the ui is served (without leading or trailing slahes), e.g. 'mailhog'. Value defaults to ''
#### Note on HTTP bind addresses

View file

@ -34,6 +34,9 @@ func configure() {
apiconf = cfgapi.Configure()
uiconf = cfgui.Configure()
comconf = cfgcom.Configure()
apiconf.WebPath = comconf.WebPath
uiconf.WebPath = comconf.WebPath
}
func main() {