Esempio n. 1
0
func StartRetentionScanner(ds DataStore) {
	cfg := config.GetDataStoreConfig()
	expRetentionPeriod.Set(int64(cfg.RetentionMinutes * 60))
	if cfg.RetentionMinutes > 0 {
		// Retention scanning enabled
		log.LogInfo("Retention configured for %v minutes", cfg.RetentionMinutes)
		go retentionScanner(ds, time.Duration(cfg.RetentionMinutes)*time.Minute,
			time.Duration(cfg.RetentionSleep)*time.Millisecond)
	} else {
		log.LogInfo("Retention scanner disabled")
	}
}
Esempio n. 2
0
// StartRetentionScanner launches a go-routine that scans for expired
// messages, following the configured interval
func StartRetentionScanner(ds DataStore, shutdownChannel chan bool) {
	globalShutdown = shutdownChannel
	retentionShutdown = make(chan bool)
	cfg := config.GetDataStoreConfig()
	expRetentionPeriod.Set(int64(cfg.RetentionMinutes * 60))
	if cfg.RetentionMinutes > 0 {
		// Retention scanning enabled
		log.Infof("Retention configured for %v minutes", cfg.RetentionMinutes)
		go retentionScanner(ds, time.Duration(cfg.RetentionMinutes)*time.Minute,
			time.Duration(cfg.RetentionSleep)*time.Millisecond)
	} else {
		log.Infof("Retention scanner disabled")
		close(retentionShutdown)
	}
}
Esempio n. 3
0
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)
	return RenderTemplate("root/status.html", w, map[string]interface{}{
		"ctx":              ctx,
		"version":          config.VERSION,
		"buildDate":        config.BUILD_DATE,
		"retentionMinutes": retentionMinutes,
		"smtpListener":     smtpListener,
		"pop3Listener":     pop3Listener,
		"webListener":      webListener,
	})
}
Esempio n. 4
0
// RootStatus serves the Inbucket status page
func RootStatus(w http.ResponseWriter, req *http.Request, ctx *httpd.Context) (err error) {
	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 httpd.RenderTemplate("root/status.html", w, map[string]interface{}{
		"ctx":             ctx,
		"version":         config.Version,
		"buildDate":       config.BuildDate,
		"smtpListener":    smtpListener,
		"pop3Listener":    pop3Listener,
		"webListener":     webListener,
		"smtpConfig":      config.GetSMTPConfig(),
		"dataStoreConfig": config.GetDataStoreConfig(),
	})
}
Esempio n. 5
0
// DefaultFileDataStore creates a new DataStore object.  It uses the inbucket.Config object to
// construct it's path.
func DefaultFileDataStore() DataStore {
	cfg := config.GetDataStoreConfig()
	return NewFileDataStore(cfg)
}