To access ctx.params we must be in a route handler, hence why we attach the blocklist middleware to routes that support contractTxId directly instead of a global middleware. Should we prefer a global middleware, we would have to parse out the contractTxId from ctx.path via regex, which has a few edge cases we may not want (e.g. the query including contractTxId for filtering which does not evaluate the contract, and instead filters out records that are assigned to that contractTxId).
Blocklist contract evaluation based on env vars.
Comment:
To access
ctx.params
we must be in a route handler, hence why we attach the blocklist middleware to routes that supportcontractTxId
directly instead of a global middleware. Should we prefer a global middleware, we would have to parse out thecontractTxId
fromctx.path
via regex, which has a few edge cases we may not want (e.g. thequery
includingcontractTxId
for filtering which does not evaluate the contract, and instead filters outrecords
that are assigned to thatcontractTxId
).