refactor: fix import cycles
This commit is contained in:
parent
72219eb59c
commit
1f7c05434a
|
@ -20,10 +20,3 @@ func registerProtocolSubdomain(portal interfaces.Portal, mux *httprouter.Router,
|
||||||
|
|
||||||
(*router)[name+"."+domain] = mux
|
(*router)[name+"."+domain] = mux
|
||||||
}
|
}
|
||||||
func ApplyMiddlewares(handler jape.Handler, middlewares ...MiddlewareFunc) jape.Handler {
|
|
||||||
// Apply each middleware in reverse order
|
|
||||||
for i := len(middlewares) - 1; i >= 0; i-- {
|
|
||||||
handler = middlewares[i](handler)
|
|
||||||
}
|
|
||||||
return handler
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package middleware
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.lumeweb.com/LumeWeb/portal/api"
|
|
||||||
"git.lumeweb.com/LumeWeb/portal/interfaces"
|
"git.lumeweb.com/LumeWeb/portal/interfaces"
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"github.com/golang-jwt/jwt/v5"
|
||||||
"go.sia.tech/jape"
|
"go.sia.tech/jape"
|
||||||
|
@ -125,7 +124,7 @@ func BuildS5TusApi(portal interfaces.Portal) jape.Handler {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Apply the middlewares to the tusJapeHandler
|
// Apply the middlewares to the tusJapeHandler
|
||||||
tusHandler := api.ApplyMiddlewares(tusJapeHandler, adaptedTusMiddleware, authMiddlewareFunc, protocolMiddleware)
|
tusHandler := ApplyMiddlewares(tusJapeHandler, adaptedTusMiddleware, authMiddlewareFunc, protocolMiddleware)
|
||||||
|
|
||||||
return tusHandler
|
return tusHandler
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package middleware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.lumeweb.com/LumeWeb/portal/api"
|
||||||
|
"go.sia.tech/jape"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ApplyMiddlewares(handler jape.Handler, middlewares ...api.MiddlewareFunc) jape.Handler {
|
||||||
|
// Apply each middleware in reverse order
|
||||||
|
for i := len(middlewares) - 1; i >= 0; i-- {
|
||||||
|
handler = middlewares[i](handler)
|
||||||
|
}
|
||||||
|
return handler
|
||||||
|
}
|
Loading…
Reference in New Issue