Introduce a commercial license option alongside AGPL-3.0-only, require a CLA for contributors, and document the terms in COMMERCIAL.md and NOTICE. Add a script to stamp SPDX headers on Go files and apply it across the tree.
21 lines
550 B
Go
21 lines
550 B
Go
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
// SPDX-FileCopyrightText: 2025-2026 Christian Galo
|
|
|
|
package middleware
|
|
|
|
import "net/http"
|
|
|
|
type Middleware func(http.Handler) http.Handler
|
|
|
|
// CreateStack creates a stack of middleware handlers
|
|
func CreateStack(middlewares ...Middleware) Middleware {
|
|
return func(nextMiddleware http.Handler) http.Handler {
|
|
for i := len(middlewares) - 1; i >= 0; i-- {
|
|
currentMiddleware := middlewares[i]
|
|
nextMiddleware = currentMiddleware(nextMiddleware)
|
|
}
|
|
|
|
return nextMiddleware
|
|
}
|
|
}
|