1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-19 02:27:03 +00:00

Follow meta-linter recommendations for all of Inbucket

- Rename BUILD_DATE to BUILDDATE in goxc
- Update travis config
- Follow linter recommendations for inbucket.go
- Follow linter recommendations for config package
- Follow linter recommendations for log package
- Follow linter recommendations for pop3d package
- Follow linter recommendations for smtpd package
- Follow linter recommendations for web package
- Fix Id -> ID in templates
- Add shebang to REST demo scripts
- Add or refine many comments
This commit is contained in:
James Hillyerd
2016-02-20 23:20:22 -08:00
parent 83f9c6aa49
commit e6b7e335cb
34 changed files with 607 additions and 411 deletions

View File

@@ -9,6 +9,7 @@ import (
"github.com/jhillyerd/inbucket/config"
)
// RootIndex serves the Inbucket landing page
func RootIndex(w http.ResponseWriter, req *http.Request, ctx *Context) (err error) {
greeting, err := ioutil.ReadFile(config.GetWebConfig().GreetingFile)
if err != nil {
@@ -21,18 +22,19 @@ func RootIndex(w http.ResponseWriter, req *http.Request, ctx *Context) (err erro
})
}
// RootStatus serves the Inbucket status page
func RootStatus(w http.ResponseWriter, req *http.Request, ctx *Context) (err error) {
retentionMinutes := config.GetDataStoreConfig().RetentionMinutes
smtpListener := fmt.Sprintf("%s:%d", config.GetSmtpConfig().Ip4address.String(),
config.GetSmtpConfig().Ip4port)
pop3Listener := fmt.Sprintf("%s:%d", config.GetPop3Config().Ip4address.String(),
config.GetPop3Config().Ip4port)
webListener := fmt.Sprintf("%s:%d", config.GetWebConfig().Ip4address.String(),
config.GetWebConfig().Ip4port)
smtpListener := fmt.Sprintf("%s:%d", config.GetSMTPConfig().IP4address.String(),
config.GetSMTPConfig().IP4port)
pop3Listener := fmt.Sprintf("%s:%d", config.GetPOP3Config().IP4address.String(),
config.GetPOP3Config().IP4port)
webListener := fmt.Sprintf("%s:%d", config.GetWebConfig().IP4address.String(),
config.GetWebConfig().IP4port)
return RenderTemplate("root/status.html", w, map[string]interface{}{
"ctx": ctx,
"version": config.VERSION,
"buildDate": config.BUILD_DATE,
"version": config.Version,
"buildDate": config.BuildDate,
"retentionMinutes": retentionMinutes,
"smtpListener": smtpListener,
"pop3Listener": pop3Listener,