New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send Guzzle configuration options through from the config file #43
Comments
Do you need to configure Guzzle requests for Sherlock only? If not, then you should already be able to do this by configuring the Guzzle component, see https://craftcms.com/docs/4.x/config/#guzzle |
I didn't know about this, so this is a big help, thank you! However, we were looking to configure domain specific variables, such as username and password, so the global settings don't help here. For now, I have edited line 140 of: /vendor/putyourlightson/craft-sherlock/src/services/TestsService.php To add the configuration we need to perform a single run, and then I will reinstall the plugin to remove my "patch". |
I added a use Craft;
use putyourlightson\sherlock\events\RunTestsEvent;
use putyourlightson\sherlock\services\TestsService;
use yii\base\Event;
Event::on(TestsService::class, TestsService::EVENT_BEFORE_RUN_TESTS,
function(RunTestsEvent $event) {
if (Craft::$app->sites->currentSite->id === 1) {
$event->client = Craft::createGuzzleClient([
'auth' => ['username', 'password'],
'timeout' => 10,
]);
}
}
); You can test this by running |
Excellent, thank you very much! I don't suppose there is any chance of this also being rolled out for the Craft 3 version of the plugin, is there? I understand if you are just adding new features to the Craft 4 version, and thank you for this, it will be a big help. |
Released in version 4.4.0. Unfortunately, Sherlock 3 (for Craft 3) is only getting bug fixes and security updates but no new features. |
Please provide a clear and concise description of your feature request, including:
I would like to be able to configure Guzzle from the config file.
A perfect example of this type of implementation can be found with Feed Me:
https://docs.craftcms.com/feed-me/v4/get-started/configuration.html#example-requestoptions
This way, I can set an auth element with username and password (for example).
The text was updated successfully, but these errors were encountered: