コード例 #1
0
ファイル: retention.go プロジェクト: hotei/inbucket
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")
	}
}
コード例 #2
0
ファイル: retention.go プロジェクト: jhillyerd/inbucket
// 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)
	}
}
コード例 #3
0
ファイル: root_controller.go プロジェクト: barbourkd/inbucket
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,
	})
}
コード例 #4
0
ファイル: root_controller.go プロジェクト: jhillyerd/inbucket
// 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(),
	})
}
コード例 #5
0
ファイル: filestore.go プロジェクト: jhillyerd/inbucket
// 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)
}