Kyon147 / laravel-shopify

A full-featured Laravel package for aiding in Shopify App development
MIT License
363 stars 107 forks source link

configure job connections #323

Closed abhihyder closed 1 week ago

abhihyder commented 3 months ago

Add Job Connections Configuration

Summary

This pull request introduces a new configuration option for setting specific job connections for webhooks, scripttags, and after_authenticate_job.

Details

This change allows developers to define separate job connections for each of these features, enabling better control and customization of their job handling process.

'job_connections' => [
    'webhooks' => env('WEBHOOKS_JOB_CONNECTION', null),
    'scripttags' => env('SCRIPTTAGS_JOB_CONNECTION', null),
    'after_authenticate' => env('AFTER_AUTHENTICATE_JOB_CONNECTION', null),
],

Environment Variables

To utilize the new job connections, the following environment variables can be set:

If these variables are not set, the default job connection will be used.

Benefits

Kyon147 commented 2 months ago

Thanks for submitting the PR. I'll review it and let you know if I have any feedback

Kyon147 commented 2 months ago

@abhihyder could you add or update the unit tests so that we have this change in coverage?

abhihyder commented 4 weeks ago

Hi @Kyon147, Thank you for the feedback!

I've updated the existing unit tests to cover the changes related to job dispatching on the correct connection. Specifically, I've added tests to ensure that the actions in AfterAuthorize, DispatchScripts, DispatchWebhooks, and the WebhookController trait are executed on the appropriate custom connection as defined in the configuration.

You can run the test cases with the following commands:

Kyon147 commented 1 week ago

Hey @abhihyder

I've fixed the lint issue and will get this out in the next release. Thanks for the PR 👍