Conversation
|
The idea looks good, custom middleware would indeed solve a lot of issues we have. Plugins were designed for another purpose however. They are too complex to use here imho. Question: are there any existing middleware modules that could be useful here and would work out of the box without explicitly writing a plugin for sinopia only? Maybe we could use: middleware:
helmet-csp:
defaultSrc: ["'self'", 'default.com']And sinopia would do |
|
Ok, how should we load in custom middleware? |
|
So what can I do to help here? |
|
This seems related to #188 |
Adding the ability to load in custom middleware.
I need a way to restrict which npm client versions can access Sinopia, and the only way to do that is to inspect the request headers. (See #187)
I'm adding this middleware loader as a generic way for the Sinopia administrator to hook into api requests by adding middleware. The middleware will be specified in the
middlewareconfig.yaml key.For now, I've set the
sanity_checkfunction to just returntrue, but I'm open to other ideas.