diff options
| author | William Hergès <william@herges.fr> | 2025-10-05 15:04:12 +0200 |
|---|---|---|
| committer | William Hergès <william@herges.fr> | 2025-10-05 15:04:12 +0200 |
| commit | 5d6198f168dd1a8598048718d149d1171df09c1a (patch) | |
| tree | 5ed6891cf0599cfd6826c57948125a9927c30a73 /backend/router.go | |
| parent | f7a41e17693dd5301413f46efecdfe4f5b94cb6f (diff) | |
perf(security): cache assets checksum
Diffstat (limited to 'backend/router.go')
| -rw-r--r-- | backend/router.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/backend/router.go b/backend/router.go index 1231fdf..fb43845 100644 --- a/backend/router.go +++ b/backend/router.go @@ -20,7 +20,8 @@ const ( Version = "0.2.0" configKey = "config" isUpdateKey = "is_update" - assetsFS = "assets_fs" + assetsFSKey = "assets_fs" + debugKey = "debug" ) //go:embed templates @@ -78,7 +79,8 @@ func NewRouter(debug bool, cfg *Config, assets fs.FS) *chi.Mux { r.Use(func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := context.WithValue(r.Context(), configKey, cfg) - ctx = context.WithValue(ctx, assetsFS, assets) + ctx = context.WithValue(ctx, assetsFSKey, assets) + ctx = context.WithValue(ctx, debugKey, debug) next.ServeHTTP(w, r.WithContext(ctx)) }) }) |
