Closed janhenckens closed 2 months ago
Something I've been meaning to do for a while is allow the enabled
setting to be a callback function to allow people greater flexibility to enable or disable the plugin.
To get this early, run composer require verbb/knock-knock:"dev-craft-4 as 2.0.11"
.
<?php
use Craft;
return [
'*' => [
'enabled' => function() {
if (Craft::$app->getRequest()->getParam('bypass')) {
return false;
}
return true;
},
],
];
Thank @engram-design, that's perfect - tested and it works!
Updated in 2.0.12
What are you trying to do?
For a large migration, we're running a redirect inventory check but that script of course runs into knock-knock for all pages.
We tried adding a query param to all URLs and allow that through regex (
/(.*)?rt=1
rt = redirect test) but that gets stripped hereWhat's your proposed solution?
I don't know if using a query parameters is the beter solution here, happy to hear your thoughts :)
Additional context
The script in question runs through Google Sheets, so setting an allowedIp isn't an option.