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

Correct the order of module configurations #16227

Merged
merged 7 commits into from
Jun 4, 2024
Merged

Conversation

MikeAlhayek
Copy link
Member

Fix #14874

In the PR, we have introduced a central constants class that manages the order of module registrations. This improvement provides a comprehensive view of all registered modules, making it easier to adjust the order as needed. If someone needs to change the order of any module, they can see at a glance if other order numbers need to be adjusted accordingly.

@MikeAlhayek MikeAlhayek requested a review from Piedone June 3, 2024 20:47
Copy link
Member

@kevinchalet kevinchalet left a comment

Choose a reason for hiding this comment

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

👍🏻

Copy link
Member

@Piedone Piedone left a comment

Choose a reason for hiding this comment

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

I've swapped out the preview packages under Lombiq's Open-Source Orchard Core Extensions, this PR and has run its tests. Those passed, so this is a good sign.

MikeAlhayek

This comment was marked as outdated.

@kevinchalet
Copy link
Member

I don't see OrchardCore.Security in the list of changed files: it doesn't have an explicit order, but we should probably give it one while we're at it. Probably just before or after CORS (but after the reverse proxy module)

@MikeAlhayek
Copy link
Member Author

I don't see OrchardCore.Security in the list of changed files: it doesn't have an explicit order, but we should probably give it one while we're at it. Probably just before or after CORS (but after the reverse proxy module)

@kevinchalet not a bad idea. I added that at the same order as CORS just to show that there is no significant difference in order between CORS and Reverse Proxy. I added a note as it must configured after the reverse proxy.

@MikeAlhayek MikeAlhayek merged commit d39c903 into main Jun 4, 2024
7 checks passed
@MikeAlhayek MikeAlhayek deleted the ma/revese-proxy-issue branch June 4, 2024 01:53
@kevinchalet
Copy link
Member

@kevinchalet not a bad idea. I added that at the same order as CORS just to show that there is no significant difference in order between CORS and Reverse Proxy. I added a note as it must configured after the reverse proxy.

👍🏻

That said, I wonder if we shouldn't use unique values to make the order more explicit: I haven't tested, but since the ordering logic is just an .OrderBy(x => x.ConfigureOrder) on the list of IStartup services, I'd assume the actual order of modules having the same value actually depends on their position in the IServiceCollection instance (when using with LINQ to Objects, .OrderBy(...) performs a stable sort, but it depends on the ordering logic of the input collection).

@MikeAlhayek
Copy link
Member Author

IMO, if there is a need to place one after another, then we should use unique values to guaranty the order. But, if there we don't care if CORS came before Security or the other way around, then I don't see the value of adding a unique value. In other words, if either Security or CORS were registered first, there should not be any issue.

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.

When accessing the site from https, the openid related address becomes http
3 participants