mirror of
https://gitlab.com/ric_harvey/MailHog.git
synced 2024-11-23 22:34:04 +00:00
Fix for mailhog/MailHog#25. Provide a new configuration parameter ui-web-path.
This commit is contained in:
parent
91a9d8afe1
commit
a7374f9f82
3 changed files with 13 additions and 0 deletions
|
@ -14,14 +14,23 @@ func DefaultConfig() *Config {
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
AuthFile string
|
AuthFile string
|
||||||
|
WebPath string
|
||||||
}
|
}
|
||||||
|
|
||||||
var cfg = DefaultConfig()
|
var cfg = DefaultConfig()
|
||||||
|
|
||||||
func Configure() *Config {
|
func Configure() *Config {
|
||||||
|
|
||||||
|
//sanitize webpath
|
||||||
|
//add a leading slash
|
||||||
|
if cfg.WebPath != "" && !(cfg.WebPath[0] == '/') {
|
||||||
|
cfg.WebPath = "/" + cfg.WebPath
|
||||||
|
}
|
||||||
|
|
||||||
return cfg
|
return cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterFlags() {
|
func RegisterFlags() {
|
||||||
flag.StringVar(&cfg.AuthFile, "auth-file", envconf.FromEnvP("MH_AUTH_FILE", "").(string), "A username:bcryptpw mapping file")
|
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 slahes), e.g. 'mailhog'. Value defaults to ''")
|
||||||
}
|
}
|
||||||
|
|
|
@ -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_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_STORAGE | -storage | memory | Set message storage: memory / mongodb
|
||||||
| MH_OUTGOING_SMTP | -outgoing-smtp | | JSON file defining outgoing SMTP servers
|
| 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
|
#### Note on HTTP bind addresses
|
||||||
|
|
||||||
|
|
3
main.go
3
main.go
|
@ -34,6 +34,9 @@ func configure() {
|
||||||
apiconf = cfgapi.Configure()
|
apiconf = cfgapi.Configure()
|
||||||
uiconf = cfgui.Configure()
|
uiconf = cfgui.Configure()
|
||||||
comconf = cfgcom.Configure()
|
comconf = cfgcom.Configure()
|
||||||
|
|
||||||
|
apiconf.WebPath = comconf.WebPath
|
||||||
|
uiconf.WebPath = comconf.WebPath
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
Loading…
Reference in a new issue