From fa27d9c6eb525b2e55c3faab5dd8a3e0e9658536 Mon Sep 17 00:00:00 2001 From: r Date: Sun, 22 Nov 2020 17:29:58 +0000 Subject: Refactor things - Remove separate auth/logging and merge them into transport.go - Add helper function for http handlers --- main.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 80baa81..636c59c 100644 --- a/main.go +++ b/main.go @@ -12,7 +12,6 @@ import ( "time" "bloat/config" - "bloat/kv" "bloat/renderer" "bloat/repo" "bloat/service" @@ -76,13 +75,13 @@ func main() { } sessionDBPath := filepath.Join(config.DatabasePath, "session") - sessionDB, err := kv.NewDatabse(sessionDBPath) + sessionDB, err := util.NewDatabse(sessionDBPath) if err != nil { errExit(err) } appDBPath := filepath.Join(config.DatabasePath, "app") - appDB, err := kv.NewDatabse(appDBPath) + appDB, err := util.NewDatabse(appDBPath) if err != nil { errExit(err) } @@ -114,9 +113,7 @@ func main() { s := service.NewService(config.ClientName, config.ClientScope, config.ClientWebsite, customCSS, config.PostFormats, renderer, sessionRepo, appRepo, config.SingleInstance) - s = service.NewAuthService(sessionRepo, appRepo, s) - s = service.NewLoggingService(logger, s) - handler := service.NewHandler(s, config.StaticDirectory) + handler := service.NewHandler(s, logger, config.StaticDirectory) logger.Println("listening on", config.ListenAddress) err = http.ListenAndServe(config.ListenAddress, handler) -- cgit v1.2.3