Skip to content
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

Add config option to enable/disable unique token #212

Merged
merged 2 commits into from
Apr 25, 2024
Merged

Add config option to enable/disable unique token #212

merged 2 commits into from
Apr 25, 2024

Conversation

it-can
Copy link
Contributor

@it-can it-can commented Apr 25, 2024

Fix for #210

Copy link
Contributor

@ryanlholt ryanlholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the dot prefix is added to the token string then I think this should be gtg.

/*
* Should a unique token be added to the route name
*/
'add_unique_token_to_route_name' => false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@it-can Just personal preference but I would probably simplify this to 'tokenize_route_name'.

Copy link
Contributor Author

@it-can it-can Apr 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think @freekmurze should decide on this one

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although tokenize_route_name would be good I thinkadd_unique_token_to_route_name is more clear / human.

src/WebhookClientServiceProvider.php Outdated Show resolved Hide resolved
Copy link
Contributor

@ryanlholt ryanlholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we default the new config variable to true?


$configName = Str::before($routeNameSuffix, '.');
if (config('webhook-client.add_unique_token_to_route_name', false)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@it-can I think this should probably default to true since the shared route names already break route caching and there is a documented feature that causes that scenario. I can definitely see the benefit of calling the routes by name but route naming is more of an underlying structure of the package and not a documented feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@freekmurze can decide on this one too...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be set to false for now, so we don't break stuff for existing users.

For a next major version, I'll consider setting it to true by default.

@freekmurze freekmurze merged commit 393d212 into spatie:main Apr 25, 2024
16 checks passed
@freekmurze
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants