From cf1d26100bf4482b0fc459791e95ade3bc405b00 Mon Sep 17 00:00:00 2001 From: Tine Date: Fri, 7 Jun 2024 11:43:32 +0200 Subject: [PATCH] feat: show version in footer --- cmd/zdravko/main.go | 2 +- pkg/server/server.go | 18 ++++++++++-------- pkg/temporal/server.go | 2 +- web/templates/components/base.tmpl | 4 +++- web/templates/templates.go | 15 +++++++++------ 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/cmd/zdravko/main.go b/cmd/zdravko/main.go index 71ca43a..cac4dc4 100644 --- a/cmd/zdravko/main.go +++ b/cmd/zdravko/main.go @@ -73,7 +73,7 @@ func main() { if startServer { slog.Info("Setting up Server") cfg := config.NewServerConfig() - server, err := server.NewServer(cfg) + server, err := server.NewServer(version, cfg) if err != nil { slog.Error("Unable to create server", "error", err) os.Exit(1) diff --git a/pkg/server/server.go b/pkg/server/server.go index b516de7..43cc23c 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -14,18 +14,20 @@ import ( ) type Server struct { - echo *echo.Echo - cfg *config.ServerConfig - logger *slog.Logger + echo *echo.Echo + cfg *config.ServerConfig + logger *slog.Logger + version string worker *Worker } -func NewServer(cfg *config.ServerConfig) (*Server, error) { +func NewServer(version string, cfg *config.ServerConfig) (*Server, error) { return &Server{ - cfg: cfg, - echo: echo.New(), - logger: slog.Default(), + cfg: cfg, + echo: echo.New(), + logger: slog.Default(), + version: version, }, nil } @@ -51,7 +53,7 @@ func (s *Server) Start() error { s.worker = NewWorker(temporalClient, s.cfg, s.logger, sqliteDb, kvStore) - templates, err := templates.NewTemplates(s.logger) + templates, err := templates.NewTemplates(s.version, s.logger) if err != nil { return errors.Wrap(err, "failed to create templates") } diff --git a/pkg/temporal/server.go b/pkg/temporal/server.go index 17287de..d7ee2e2 100644 --- a/pkg/temporal/server.go +++ b/pkg/temporal/server.go @@ -16,7 +16,7 @@ import ( func NewServer(l *slog.Logger, cfg *config.Config, tokenKeyProvider authorization.TokenKeyProvider) (t.Server, error) { logger := slogLogger{ log: l, - level: slog.LevelDebug, + level: slog.LevelInfo, } sqlConfig := cfg.Persistence.DataStores[PersistenceStoreName].SQL diff --git a/web/templates/components/base.tmpl b/web/templates/components/base.tmpl index fd0e549..6516e22 100644 --- a/web/templates/components/base.tmpl +++ b/web/templates/components/base.tmpl @@ -39,7 +39,9 @@ {{ template "main" . }}