Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import zio.http.internal.FetchDriver

trait ZClientPlatformSpecific {

def requiringConfig: ZLayer[ZClient.Config, Throwable, Client] =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would have ideally like to have called this something like customized or configured, but both of those are already taken by type-mismatching platform-specific overrides. Open to naming suggestions if something else is preferable.

Copy link
Contributor

Choose a reason for hiding this comment

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

You could do fromConfig, withConfig or even configured, since the new one has no params

live

def customized: ZLayer[Config with ZClient.Driver[Any, Scope, Throwable], Throwable, Client] = {
implicit val trace: Trace = Trace.empty
ZLayer.scoped {
Expand Down Expand Up @@ -35,7 +38,7 @@ trait ZClientPlatformSpecific {

def default: ZLayer[Any, Throwable, Client] = {
implicit val trace: Trace = Trace.empty
ZLayer.succeed(Config.default) >>> live
ZLayer.succeed(Config.default) >>> requiringConfig
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import zio.http.netty.client.NettyClientDriver

trait ZClientPlatformSpecific {

def requiringConfig: ZLayer[ZClient.Config, Throwable, Client] = {
implicit val trace: Trace = Trace.empty
(ZLayer.succeed(NettyConfig.defaultWithFastShutdown) ++ DnsResolver.default) >>> live
}

def customized: ZLayer[Config with ClientDriver with DnsResolver, Throwable, Client] = {
implicit val trace: Trace = Trace.empty
ZLayer.scoped {
Expand Down Expand Up @@ -41,8 +46,7 @@ trait ZClientPlatformSpecific {

def default: ZLayer[Any, Throwable, Client] = {
implicit val trace: Trace = Trace.empty
(ZLayer.succeed(Config.default) ++ ZLayer.succeed(NettyConfig.defaultWithFastShutdown) ++
DnsResolver.default) >>> live
ZLayer.succeed(Config.default) >>> requiringConfig
}

}
Loading