Merge pull request #2315 from rehanone/develop/ember-client

Replace `http4s-blaze-client` with `http4s-ember-client`.
This commit is contained in:
eikek 2023-10-23 23:22:57 +02:00 committed by GitHub
commit f7f93c5b2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 15 deletions

3
.gitignore vendored
View File

@ -27,3 +27,6 @@ _site/
/website/site/templates/shortcodes/config.env.txt
/docker/docs
/docker/dev-log
.idea/*
sbt.json

View File

@ -19,8 +19,8 @@ import docspell.store.Store
import docspell.store.records.RInternalSetting
import org.http4s.HttpApp
import org.http4s.blaze.client.BlazeClientBuilder
import org.http4s.blaze.server.BlazeServerBuilder
import org.http4s.ember.client.EmberClientBuilder
import org.http4s.implicits._
import org.http4s.server.Router
import org.http4s.server.middleware.Logger
@ -46,7 +46,7 @@ object JoexServer {
pools.connectEC
)
settings <- Resource.eval(store.transact(RInternalSetting.create))
httpClient <- BlazeClientBuilder[F].resource
httpClient <- EmberClientBuilder.default[F].build
pubSub <- NaivePubSub(
cfg.pubSubConfig(settings.internalRouteKey),
store,
@ -64,7 +64,7 @@ object JoexServer {
).orNotFound
// With Middlewares in place
finalHttpApp = Logger.httpApp(false, false)(httpApp)
finalHttpApp = Logger.httpApp(logHeaders = false, logBody = false)(httpApp)
} yield App(finalHttpApp, signal, exitCode)

View File

@ -15,8 +15,8 @@ import docspell.scheduler.Task
import docspell.store.Store
import docspell.store.records._
import org.http4s.blaze.client.BlazeClientBuilder
import org.http4s.client.Client
import org.http4s.ember.client.EmberClientBuilder
object CheckNodesTask {
def apply[F[_]: Async](
@ -27,8 +27,7 @@ object CheckNodesTask {
if (cfg.enabled)
for {
_ <- ctx.logger.info("Check nodes reachability")
ec = scala.concurrent.ExecutionContext.global
_ <- BlazeClientBuilder[F].withExecutionContext(ec).resource.use { client =>
_ <- EmberClientBuilder.default[F].build.use { client =>
checkNodes(ctx.logger, store, client)
}
_ <- ctx.logger.info(

View File

@ -12,9 +12,9 @@ import cats.implicits._
import docspell.common.{Ident, LenientUri}
import docspell.joexapi.model.{AddonSupport, BasicResult}
import org.http4s.blaze.client.BlazeClientBuilder
import org.http4s.circe.CirceEntityDecoder
import org.http4s.client.Client
import org.http4s.ember.client.EmberClientBuilder
import org.http4s.{Method, Request, Uri}
trait JoexClient[F[_]] {
@ -73,5 +73,5 @@ object JoexClient {
}
def resource[F[_]: Async]: Resource[F, JoexClient[F]] =
BlazeClientBuilder[F].resource.map(apply[F])
EmberClientBuilder.default[F].build.map(apply[F])
}

View File

@ -30,7 +30,8 @@ sealed trait Channel {
}
object Channel {
implicit val jsonConfig = Configuration.default.withDiscriminator("channelType")
implicit val jsonConfig: Configuration =
Configuration.default.withDiscriminator("channelType")
final case class Mail(
id: Ident,
@ -38,7 +39,7 @@ object Channel {
connection: Ident,
recipients: Nel[MailAddress]
) extends Channel {
val channelType = ChannelType.Mail
val channelType: ChannelType = ChannelType.Mail
def fold[A](
f1: Mail => A,
f2: Gotify => A,
@ -85,7 +86,7 @@ object Channel {
roomId: String,
accessToken: Password
) extends Channel {
val channelType = ChannelType.Matrix
val channelType: ChannelType = ChannelType.Matrix
def fold[A](
f1: Mail => A,
f2: Gotify => A,
@ -101,7 +102,7 @@ object Channel {
final case class Http(id: Ident, name: Option[String], url: LenientUri)
extends Channel {
val channelType = ChannelType.Http
val channelType: ChannelType = ChannelType.Http
def fold[A](
f1: Mail => A,
f2: Gotify => A,

View File

@ -24,9 +24,9 @@ import docspell.store.Store
import docspell.store.records.RInternalSetting
import org.http4s._
import org.http4s.blaze.client.BlazeClientBuilder
import org.http4s.blaze.server.BlazeServerBuilder
import org.http4s.dsl.Http4sDsl
import org.http4s.ember.client.EmberClientBuilder
import org.http4s.headers.Location
import org.http4s.implicits._
import org.http4s.server.Router
@ -83,7 +83,7 @@ object RestServer {
(RestApp[F], NaivePubSub[F], RInternalSetting)
] =
for {
httpClient <- BlazeClientBuilder[F].resource
httpClient <- EmberClientBuilder.default[F].build
store <- Store.create[F](
cfg.backend.jdbc,
cfg.backend.databaseSchema,

View File

@ -239,7 +239,7 @@ object Dependencies {
val fs2 = fs2Core ++ fs2Io
val http4sClient = Seq(
"org.http4s" %% "http4s-blaze-client" % "0.23.14"
"org.http4s" %% "http4s-ember-client" % Http4sVersion
)
val http4sCirce = Seq(