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

feat(middleware): add HostFilterLater::disable #1213

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

niklasad1
Copy link
Member

This is just a convenience method to make it easier to use in some scenarios because when enabled it will generate another type

Such as this example won't compile:

   let middleware = if host_filter {
       tower::ServiceBuilder::new()
           .layer(HostFilterLayer::new(["example.com"]).unwrap())
           .layer(ProxyGetRequestLayer::new("/health", "system_health").unwrap())
   } else {
       tower::ServiceBuilder::new()
   };

@niklasad1 niklasad1 requested a review from a team as a code owner October 11, 2023 09:14
Copy link
Contributor

@lexnv lexnv left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Collaborator

@jsdw jsdw left a comment

Choose a reason for hiding this comment

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

Maybe an argument for not exposing the ServiceBuilder stuff at all and accepting layers instead or something, but yup lgtm :)

@niklasad1 niklasad1 merged commit bccf49c into master Oct 11, 2023
15 checks passed
@niklasad1 niklasad1 deleted the na-host-filter-layer-disable branch October 11, 2023 13:26
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