kubukoz / sup

Composable, purely functional healthchecks in Scala.
https://sup.kubukoz.com
Apache License 2.0
185 stars 27 forks source link

String to Uri #434

Open benkio opened 3 years ago

benkio commented 3 years ago

I'm trying this method https://github.com/kubukoz/sup/blob/9887f19c9873880252f96b86cd9d88de39eeca2e/modules/http4s/src/main/scala/sup/modules/http4s.scala#L19-L22

and I found that, overriding the path field, I can't put the health check route endpoint far from the root of the service, eg:

I think the parameter type should change, from String to Uri

kubukoz commented 3 years ago

hmm Uri has the problem that it could be absolute. While I agree the current state is problematic, I'm not convinced that's the best solution. Maybe a list of segments instead?

A workaround at the moment would be to wrap these routes in Router to add extra segments. e.g. Router("bar" -> healthCheckRoutes(..., "healthCheckFoo")).

@rossabaker what do you think about using Uri in this case?

rossabaker commented 3 years ago

A Uri.Path is basically just a Vector of segments that may or may not be absolute. Even if it is absolute, you can ignore that and append it to some other prefix. And you won't have schemes, authorities, etc. to discard.

kubukoz commented 3 years ago

oh, Uri.Path sounds great then. Thanks!

I'd add that, but keep the existing signature as well.