From 656ff3931cf86c50a0b54da43cbf5f68344c58e0 Mon Sep 17 00:00:00 2001 From: r Date: Wed, 25 Dec 2019 16:38:47 +0000 Subject: Update header template and add option for custom css --- main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'main.go') diff --git a/main.go b/main.go index ad62976..f9fdc8f 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "net/http" "os" "path/filepath" + "strings" "time" "web/config" @@ -52,6 +53,12 @@ func main() { sessionRepo := repository.NewSessionRepository(sessionDB) appRepo := repository.NewAppRepository(appDB) + customCSS := config.CustomCSS + if !strings.HasPrefix(customCSS, "http://") && + !strings.HasPrefix(customCSS, "https://") { + customCSS = "/static/" + customCSS + } + var logger *log.Logger if len(config.Logfile) < 1 { logger = log.New(os.Stdout, "", log.LstdFlags) @@ -64,7 +71,7 @@ func main() { logger = log.New(lf, "", log.LstdFlags) } - s := service.NewService(config.ClientName, config.ClientScope, config.ClientWebsite, renderer, sessionRepo, appRepo) + s := service.NewService(config.ClientName, config.ClientScope, config.ClientWebsite, customCSS, renderer, sessionRepo, appRepo) s = service.NewAuthService(sessionRepo, appRepo, s) s = service.NewLoggingService(logger, s) handler := service.NewHandler(s, config.StaticDirectory) -- cgit v1.2.3