aboutsummaryrefslogtreecommitdiff
path: root/cmd/web/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/web/server.go')
-rw-r--r--cmd/web/server.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/cmd/web/server.go b/cmd/web/server.go
index e76b6b2..d13cd58 100644
--- a/cmd/web/server.go
+++ b/cmd/web/server.go
@@ -25,12 +25,12 @@ import (
25 "golang.org/x/time/rate" 25 "golang.org/x/time/rate"
26) 26)
27 27
28func Register(root *cobra.Command, embeddedTemplates fs.FS) { 28func Register(root *cobra.Command, embeddedTemplates fs.FS, version string) {
29 webCmd := &cobra.Command{ 29 webCmd := &cobra.Command{
30 Use: "web [options]", 30 Use: "web [options]",
31 Short: "Run web server", 31 Short: "Run web server",
32 Run: func(c *cobra.Command, args []string) { 32 Run: func(c *cobra.Command, args []string) {
33 webMain(app.NewConfigFromCmd(c), embeddedTemplates) 33 webMain(app.NewConfigFromCmd(c), embeddedTemplates, version)
34 }, 34 },
35 } 35 }
36 36
@@ -53,7 +53,7 @@ func Register(root *cobra.Command, embeddedTemplates fs.FS) {
53 root.AddCommand(webCmd) 53 root.AddCommand(webCmd)
54} 54}
55 55
56func webMain(cfg app.Config, embeddedTemplates fs.FS) { 56func webMain(cfg app.Config, embeddedTemplates fs.FS, version string) {
57 ctx := context.Background() 57 ctx := context.Background()
58 58
59 s, err := glecho.NewDefaultEchoWithConfig(glecho.EchoConfig{ 59 s, err := glecho.NewDefaultEchoWithConfig(glecho.EchoConfig{
@@ -86,6 +86,7 @@ func webMain(cfg app.Config, embeddedTemplates fs.FS) {
86 if err = s.Init(); err != nil { 86 if err = s.Init(); err != nil {
87 log.Fatalf("Error initializing echo: %w", err) 87 log.Fatalf("Error initializing echo: %w", err)
88 } 88 }
89 s.Use(middleware.AddServerHeader(version))
89 90
90 mongo, err := mongodb.Connect(ctx, cfg.MongoDbUri, cfg.MongodbVaultPath) 91 mongo, err := mongodb.Connect(ctx, cfg.MongoDbUri, cfg.MongodbVaultPath)
91 if err != nil { 92 if err != nil {