Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a new configuration parameter ui-web-path #80

Merged
merged 1 commit into from
Mar 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 slahes), e.g. 'mailhog'. Value defaults to ''")
}
1 change: 1 addition & 0 deletions docs/CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down