1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 09:37:02 +00:00

storage: More refactoring for #69

- retention: Start from pkg main instead of server/smtp
- file: Remove DefaultStore() constructor
- storage: AllMailboxes replaced with VisitMailboxes for #69
- test: Stub VisitMailboxes for #80
This commit is contained in:
James Hillyerd
2018-03-10 22:05:10 -08:00
parent 9c18f1fb30
commit d9b5e40c87
9 changed files with 106 additions and 107 deletions

View File

@@ -19,6 +19,7 @@ import (
"github.com/jhillyerd/inbucket/pkg/server/pop3"
"github.com/jhillyerd/inbucket/pkg/server/smtp"
"github.com/jhillyerd/inbucket/pkg/server/web"
"github.com/jhillyerd/inbucket/pkg/storage"
"github.com/jhillyerd/inbucket/pkg/storage/file"
"github.com/jhillyerd/inbucket/pkg/webui"
)
@@ -115,8 +116,11 @@ func main() {
// Create message hub
msgHub := msghub.New(rootCtx, config.GetWebConfig().MonitorHistory)
// Grab our datastore
ds := file.DefaultStore()
// Setup our datastore
dscfg := config.GetDataStoreConfig()
ds := file.New(dscfg)
retentionScanner := storage.NewRetentionScanner(dscfg, ds, shutdownChan)
retentionScanner.Start()
// Start HTTP server
web.Initialize(config.GetWebConfig(), shutdownChan, ds, msgHub)
@@ -160,6 +164,7 @@ signalLoop:
go timedExit()
smtpServer.Drain()
pop3Server.Drain()
retentionScanner.Join()
removePIDFile()
}