aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2021-11-17 15:47:51 -0800
committerMike Crute <mike@crute.us>2021-11-17 15:47:51 -0800
commit375654659ce828de4c24035c023c9ab551a37410 (patch)
tree45f4367a4532abb8a883df0842f7cd591e61f795 /cmd
parentbcd64c17f857feda40fa4f1ba4e1aa910bbeb567 (diff)
downloadcloud-identity-broker-375654659ce828de4c24035c023c9ab551a37410.tar.bz2
cloud-identity-broker-375654659ce828de4c24035c023c9ab551a37410.tar.xz
cloud-identity-broker-375654659ce828de4c24035c023c9ab551a37410.zip
Add version to headers
Diffstat (limited to 'cmd')
-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 {