mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-17 09:37:02 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c34549e783 | ||
|
|
13868d85d4 |
@@ -8,6 +8,6 @@
|
||||
"Include": "README*,LICENSE*,inbucket.bat,etc,themes"
|
||||
},
|
||||
"PackageVersion": "1.0",
|
||||
"PrereleaseInfo": "rc3",
|
||||
"PrereleaseInfo": "",
|
||||
"FormatVersion": "0.8"
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ Read more at the [Inbucket website][Inbucket]
|
||||
Development Status
|
||||
------------------
|
||||
|
||||
Inbucket is currently release-candidate quality: it is being used for real work.
|
||||
Inbucket is currently production quality: it is being used for real work.
|
||||
|
||||
Please check the [issues list][Issues]
|
||||
for more details.
|
||||
|
||||
@@ -46,6 +46,10 @@ type DataStoreConfig struct {
|
||||
}
|
||||
|
||||
var (
|
||||
// Build info, set by main
|
||||
VERSION = ""
|
||||
BUILD_DATE = ""
|
||||
|
||||
// Global goconfig object
|
||||
Config *config.Config
|
||||
|
||||
|
||||
32
inbucket.go
32
inbucket.go
@@ -19,21 +19,31 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Command line flags
|
||||
var help = flag.Bool("help", false, "Displays this help")
|
||||
var pidfile = flag.String("pidfile", "none", "Write our PID into the specified file")
|
||||
var logfile = flag.String("logfile", "stderr", "Write out log into the specified file")
|
||||
var (
|
||||
// Build info, populated during linking by goxc
|
||||
VERSION = "1.0"
|
||||
BUILD_DATE = "undefined"
|
||||
|
||||
// startTime is used to calculate uptime of Inbucket
|
||||
var startTime = time.Now()
|
||||
// Command line flags
|
||||
help = flag.Bool("help", false, "Displays this help")
|
||||
pidfile = flag.String("pidfile", "none", "Write our PID into the specified file")
|
||||
logfile = flag.String("logfile", "stderr", "Write out log into the specified file")
|
||||
|
||||
// The file we send log output to, will be nil for stderr or stdout
|
||||
var logf *os.File
|
||||
// startTime is used to calculate uptime of Inbucket
|
||||
startTime = time.Now()
|
||||
|
||||
var smtpServer *smtpd.Server
|
||||
var pop3Server *pop3d.Server
|
||||
// The file we send log output to, will be nil for stderr or stdout
|
||||
logf *os.File
|
||||
|
||||
// Server instances
|
||||
smtpServer *smtpd.Server
|
||||
pop3Server *pop3d.Server
|
||||
)
|
||||
|
||||
func main() {
|
||||
config.VERSION = VERSION
|
||||
config.BUILD_DATE = BUILD_DATE
|
||||
|
||||
flag.Parse()
|
||||
if *help {
|
||||
flag.Usage()
|
||||
@@ -82,6 +92,8 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
log.LogInfo("Inbucket %v (%v) starting...", config.VERSION, config.BUILD_DATE)
|
||||
|
||||
// Write pidfile if requested
|
||||
// TODO: Probably supposed to remove pidfile during shutdown
|
||||
if *pidfile != "none" {
|
||||
|
||||
@@ -320,7 +320,7 @@ table.metrics {
|
||||
width: 15em;
|
||||
}
|
||||
|
||||
.metrics td {
|
||||
.metrics td.number {
|
||||
width: 10em;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,6 +154,10 @@
|
||||
<div class="box">
|
||||
<h3>Configuration</h3>
|
||||
<table class="metrics">
|
||||
<tr>
|
||||
<th>Version:</th>
|
||||
<td><span>{{.version}}, built on {{.buildDate}}</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>SMTP Listener:</th>
|
||||
<td><span>{{.smtpListener}}</span></td>
|
||||
@@ -174,29 +178,29 @@
|
||||
<table class="metrics">
|
||||
<tr>
|
||||
<th>Uptime:</th>
|
||||
<td><span id="m-uptime">.</span></td>
|
||||
<td class="number"><span id="m-uptime">.</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>System Memory:</th>
|
||||
<td><span id="m-memstatsSys">.</span></td>
|
||||
<td class="number"><span id="m-memstatsSys">.</span></td>
|
||||
<td class="sparkline"><span id="s-memstatsSys">.</span></td>
|
||||
<td>(10min)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Heap Size:</th>
|
||||
<td><span id="m-memstatsHeapSys">.</span></td>
|
||||
<td class="number"><span id="m-memstatsHeapSys">.</span></td>
|
||||
<td class="sparkline"><span id="s-memstatsHeapSys">.</span></td>
|
||||
<td>(10min)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Heap In-Use:</th>
|
||||
<td><span id="m-memstatsHeapAlloc">.</span></td>
|
||||
<td class="number"><span id="m-memstatsHeapAlloc">.</span></td>
|
||||
<td class="sparkline"><span id="s-memstatsHeapAlloc">.</span></td>
|
||||
<td>(10min)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Heap # Objects:</th>
|
||||
<td><span id="m-memstatsHeapObjects">.</span></td>
|
||||
<td class="number"><span id="m-memstatsHeapObjects">.</span></td>
|
||||
<td class="sparkline"><span id="s-memstatsHeapObjects">.</span></td>
|
||||
<td>(10min)</td>
|
||||
</tr>
|
||||
@@ -208,31 +212,31 @@
|
||||
<table class="metrics">
|
||||
<tr>
|
||||
<th>Current Connections:</th>
|
||||
<td><span id="m-smtpConnectsCurrent">.</span></td>
|
||||
<td class="number"><span id="m-smtpConnectsCurrent">.</span></td>
|
||||
<td class="sparkline"><span id="s-smtpConnectsCurrent">.</span></td>
|
||||
<td>(10min)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Total Connections:</th>
|
||||
<td><span id="m-smtpConnectsTotal">.</span></td>
|
||||
<td class="number"><span id="m-smtpConnectsTotal">.</span></td>
|
||||
<td class="sparkline"><span id="s-smtpConnectsTotal">.</span></td>
|
||||
<td>(60min)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Messages Received:</th>
|
||||
<td><span id="m-smtpReceivedTotal">.</span></td>
|
||||
<td class="number"><span id="m-smtpReceivedTotal">.</span></td>
|
||||
<td class="sparkline"><span id="s-smtpReceivedTotal">.</span></td>
|
||||
<td>(60min)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Errors Logged:</th>
|
||||
<td><span id="m-smtpErrorsTotal">.</span></td>
|
||||
<td class="number"><span id="m-smtpErrorsTotal">.</span></td>
|
||||
<td class="sparkline"><span id="s-smtpErrorsTotal"></span></td>
|
||||
<td>(60min)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Warnings Logged:</th>
|
||||
<td><span id="m-smtpWarnsTotal">.</span></td>
|
||||
<td class="number"><span id="m-smtpWarnsTotal">.</span></td>
|
||||
<td class="sparkline"><span id="s-smtpWarnsTotal"></span></td>
|
||||
<td>(60min)</td>
|
||||
</tr>
|
||||
@@ -264,13 +268,13 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Retention Deletes:</th>
|
||||
<td><span id="m-retentionDeletesTotal">.</span></td>
|
||||
<td class="number"><span id="m-retentionDeletesTotal">.</span></td>
|
||||
<td class="sparkline"><span id="s-retentionDeletesTotal"></span></td>
|
||||
<td>(60min)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Currently Retained:</th>
|
||||
<td><span id="m-retainedCurrent">.</span></td>
|
||||
<td class="number"><span id="m-retainedCurrent">.</span></td>
|
||||
<td class="sparkline"><span id="s-retainedCurrent"></span></td>
|
||||
<td>(60min)</td>
|
||||
</tr>
|
||||
|
||||
@@ -210,7 +210,7 @@ func MailboxHtml(w http.ResponseWriter, req *http.Request, ctx *Context) (err er
|
||||
return err
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "text/html")
|
||||
w.Header().Set("Content-Type", "text/html; charset=UTF-8")
|
||||
return RenderPartial("mailbox/_html.html", w, map[string]interface{}{
|
||||
"ctx": ctx,
|
||||
"name": name,
|
||||
|
||||
@@ -13,9 +13,9 @@ func RootIndex(w http.ResponseWriter, req *http.Request, ctx *Context) (err erro
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to load greeting: %v", err)
|
||||
}
|
||||
|
||||
|
||||
return RenderTemplate("root/index.html", w, map[string]interface{}{
|
||||
"ctx": ctx,
|
||||
"ctx": ctx,
|
||||
"greeting": template.HTML(string(greeting)),
|
||||
})
|
||||
}
|
||||
@@ -30,6 +30,8 @@ func RootStatus(w http.ResponseWriter, req *http.Request, ctx *Context) (err err
|
||||
config.GetWebConfig().Ip4port)
|
||||
return RenderTemplate("root/status.html", w, map[string]interface{}{
|
||||
"ctx": ctx,
|
||||
"version": config.VERSION,
|
||||
"buildDate": config.BUILD_DATE,
|
||||
"retentionMinutes": retentionMinutes,
|
||||
"smtpListener": smtpListener,
|
||||
"pop3Listener": pop3Listener,
|
||||
|
||||
Reference in New Issue
Block a user