fix: remove extra AppVersion context key entry
This commit is contained in:
parent
b329fb3e19
commit
7e3a2db356
6 changed files with 2 additions and 21 deletions
|
|
@ -32,7 +32,6 @@ func guestContext() context.Context {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx = ctxkeys.WithConfig(ctx, testutil.TestConfig().Sanitized())
|
ctx = ctxkeys.WithConfig(ctx, testutil.TestConfig().Sanitized())
|
||||||
ctx = ctxkeys.WithCSRFToken(ctx, "test")
|
ctx = ctxkeys.WithCSRFToken(ctx, "test")
|
||||||
ctx = ctxkeys.WithAppVersion(ctx, "test")
|
|
||||||
return ctx
|
return ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
package middleware
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"git.juancwu.dev/juancwu/budgit/internal/ctxkeys"
|
|
||||||
)
|
|
||||||
|
|
||||||
func AppVersion(version string) func(http.Handler) http.Handler {
|
|
||||||
return func(next http.Handler) http.Handler {
|
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
ctx := ctxkeys.WithAppVersion(r.Context(), version)
|
|
||||||
next.ServeHTTP(w, r.WithContext(ctx))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -298,7 +298,6 @@ func SetupRoutes(a *app.App) http.Handler {
|
||||||
handler := middleware.Chain(
|
handler := middleware.Chain(
|
||||||
mux,
|
mux,
|
||||||
middleware.SecurityHeaders(),
|
middleware.SecurityHeaders(),
|
||||||
middleware.AppVersion(a.Cfg.Version),
|
|
||||||
middleware.Config(a.Cfg),
|
middleware.Config(a.Cfg),
|
||||||
middleware.RequestLogging,
|
middleware.RequestLogging,
|
||||||
middleware.NoCacheDynamic,
|
middleware.NoCacheDynamic,
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ func AuthenticatedContext(user *model.User, profile *model.Profile) context.Cont
|
||||||
ctx = ctxkeys.WithProfile(ctx, profile)
|
ctx = ctxkeys.WithProfile(ctx, profile)
|
||||||
ctx = ctxkeys.WithConfig(ctx, TestConfig().Sanitized())
|
ctx = ctxkeys.WithConfig(ctx, TestConfig().Sanitized())
|
||||||
ctx = ctxkeys.WithCSRFToken(ctx, "test-csrf-token")
|
ctx = ctxkeys.WithCSRFToken(ctx, "test-csrf-token")
|
||||||
ctx = ctxkeys.WithAppVersion(ctx, "test")
|
|
||||||
return ctx
|
return ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ templ App(title string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<div class="px-2 py-1">
|
<div class="px-2 py-1">
|
||||||
<span class="text-xs text-muted-foreground">App version: { ctxkeys.AppVersion(ctx) }</span>
|
<span class="text-xs text-muted-foreground">App version: { cfg.Version }</span>
|
||||||
</div>
|
</div>
|
||||||
@sidebar.Separator()
|
@sidebar.Separator()
|
||||||
@sidebar.Menu() {
|
@sidebar.Menu() {
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ templ Space(title string, space *model.Space) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<div class="px-2 py-1">
|
<div class="px-2 py-1">
|
||||||
<span class="text-xs text-muted-foreground">App version: { ctxkeys.AppVersion(ctx) }</span>
|
<span class="text-xs text-muted-foreground">App version: { cfg.Version }</span>
|
||||||
</div>
|
</div>
|
||||||
@sidebar.Separator()
|
@sidebar.Separator()
|
||||||
@sidebar.Menu() {
|
@sidebar.Menu() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue