Skip to content

Commit

Permalink
chore: Add comment to FeatureFlagMiddleware
Browse files Browse the repository at this point in the history
  • Loading branch information
juggernot325 committed Nov 15, 2023
1 parent 1f5284a commit b722bdd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/api/src/api/middleware/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ func SecureHandlerMiddleware(cfg config.Configuration, contentSecurityPolicy str
}).Handler
}

// FeatureFlagMiddleware is a middleware that enables or disables a given endpoint based on the status of the passed feature flag.
// It is intended to be attached directly to endpoints that should be affected by the feature flag. The feature flag determining the
// endpoint's availability should be specified in flagKey.
//
// If the flag is enabled, the endpoint will work as intended. If the flag is disabled, a 404 will be returned to the user.
func FeatureFlagMiddleware(db database.Database, flagKey string) mux.MiddlewareFunc {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(response http.ResponseWriter, request *http.Request) {
Expand Down

0 comments on commit b722bdd

Please sign in to comment.