mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-03-31 05:15:08 +00:00
Merge pull request #2315 from rehanone/develop/ember-client
Replace `http4s-blaze-client` with `http4s-ember-client`.
This commit is contained in:
commit
f7f93c5b2a
3
.gitignore
vendored
3
.gitignore
vendored
@ -27,3 +27,6 @@ _site/
|
|||||||
/website/site/templates/shortcodes/config.env.txt
|
/website/site/templates/shortcodes/config.env.txt
|
||||||
/docker/docs
|
/docker/docs
|
||||||
/docker/dev-log
|
/docker/dev-log
|
||||||
|
|
||||||
|
.idea/*
|
||||||
|
sbt.json
|
||||||
|
@ -19,8 +19,8 @@ import docspell.store.Store
|
|||||||
import docspell.store.records.RInternalSetting
|
import docspell.store.records.RInternalSetting
|
||||||
|
|
||||||
import org.http4s.HttpApp
|
import org.http4s.HttpApp
|
||||||
import org.http4s.blaze.client.BlazeClientBuilder
|
|
||||||
import org.http4s.blaze.server.BlazeServerBuilder
|
import org.http4s.blaze.server.BlazeServerBuilder
|
||||||
|
import org.http4s.ember.client.EmberClientBuilder
|
||||||
import org.http4s.implicits._
|
import org.http4s.implicits._
|
||||||
import org.http4s.server.Router
|
import org.http4s.server.Router
|
||||||
import org.http4s.server.middleware.Logger
|
import org.http4s.server.middleware.Logger
|
||||||
@ -46,7 +46,7 @@ object JoexServer {
|
|||||||
pools.connectEC
|
pools.connectEC
|
||||||
)
|
)
|
||||||
settings <- Resource.eval(store.transact(RInternalSetting.create))
|
settings <- Resource.eval(store.transact(RInternalSetting.create))
|
||||||
httpClient <- BlazeClientBuilder[F].resource
|
httpClient <- EmberClientBuilder.default[F].build
|
||||||
pubSub <- NaivePubSub(
|
pubSub <- NaivePubSub(
|
||||||
cfg.pubSubConfig(settings.internalRouteKey),
|
cfg.pubSubConfig(settings.internalRouteKey),
|
||||||
store,
|
store,
|
||||||
@ -64,7 +64,7 @@ object JoexServer {
|
|||||||
).orNotFound
|
).orNotFound
|
||||||
|
|
||||||
// With Middlewares in place
|
// With Middlewares in place
|
||||||
finalHttpApp = Logger.httpApp(false, false)(httpApp)
|
finalHttpApp = Logger.httpApp(logHeaders = false, logBody = false)(httpApp)
|
||||||
|
|
||||||
} yield App(finalHttpApp, signal, exitCode)
|
} yield App(finalHttpApp, signal, exitCode)
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ import docspell.scheduler.Task
|
|||||||
import docspell.store.Store
|
import docspell.store.Store
|
||||||
import docspell.store.records._
|
import docspell.store.records._
|
||||||
|
|
||||||
import org.http4s.blaze.client.BlazeClientBuilder
|
|
||||||
import org.http4s.client.Client
|
import org.http4s.client.Client
|
||||||
|
import org.http4s.ember.client.EmberClientBuilder
|
||||||
|
|
||||||
object CheckNodesTask {
|
object CheckNodesTask {
|
||||||
def apply[F[_]: Async](
|
def apply[F[_]: Async](
|
||||||
@ -27,8 +27,7 @@ object CheckNodesTask {
|
|||||||
if (cfg.enabled)
|
if (cfg.enabled)
|
||||||
for {
|
for {
|
||||||
_ <- ctx.logger.info("Check nodes reachability")
|
_ <- ctx.logger.info("Check nodes reachability")
|
||||||
ec = scala.concurrent.ExecutionContext.global
|
_ <- EmberClientBuilder.default[F].build.use { client =>
|
||||||
_ <- BlazeClientBuilder[F].withExecutionContext(ec).resource.use { client =>
|
|
||||||
checkNodes(ctx.logger, store, client)
|
checkNodes(ctx.logger, store, client)
|
||||||
}
|
}
|
||||||
_ <- ctx.logger.info(
|
_ <- ctx.logger.info(
|
||||||
|
@ -12,9 +12,9 @@ import cats.implicits._
|
|||||||
import docspell.common.{Ident, LenientUri}
|
import docspell.common.{Ident, LenientUri}
|
||||||
import docspell.joexapi.model.{AddonSupport, BasicResult}
|
import docspell.joexapi.model.{AddonSupport, BasicResult}
|
||||||
|
|
||||||
import org.http4s.blaze.client.BlazeClientBuilder
|
|
||||||
import org.http4s.circe.CirceEntityDecoder
|
import org.http4s.circe.CirceEntityDecoder
|
||||||
import org.http4s.client.Client
|
import org.http4s.client.Client
|
||||||
|
import org.http4s.ember.client.EmberClientBuilder
|
||||||
import org.http4s.{Method, Request, Uri}
|
import org.http4s.{Method, Request, Uri}
|
||||||
|
|
||||||
trait JoexClient[F[_]] {
|
trait JoexClient[F[_]] {
|
||||||
@ -73,5 +73,5 @@ object JoexClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def resource[F[_]: Async]: Resource[F, JoexClient[F]] =
|
def resource[F[_]: Async]: Resource[F, JoexClient[F]] =
|
||||||
BlazeClientBuilder[F].resource.map(apply[F])
|
EmberClientBuilder.default[F].build.map(apply[F])
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,8 @@ sealed trait Channel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
object Channel {
|
object Channel {
|
||||||
implicit val jsonConfig = Configuration.default.withDiscriminator("channelType")
|
implicit val jsonConfig: Configuration =
|
||||||
|
Configuration.default.withDiscriminator("channelType")
|
||||||
|
|
||||||
final case class Mail(
|
final case class Mail(
|
||||||
id: Ident,
|
id: Ident,
|
||||||
@ -38,7 +39,7 @@ object Channel {
|
|||||||
connection: Ident,
|
connection: Ident,
|
||||||
recipients: Nel[MailAddress]
|
recipients: Nel[MailAddress]
|
||||||
) extends Channel {
|
) extends Channel {
|
||||||
val channelType = ChannelType.Mail
|
val channelType: ChannelType = ChannelType.Mail
|
||||||
def fold[A](
|
def fold[A](
|
||||||
f1: Mail => A,
|
f1: Mail => A,
|
||||||
f2: Gotify => A,
|
f2: Gotify => A,
|
||||||
@ -85,7 +86,7 @@ object Channel {
|
|||||||
roomId: String,
|
roomId: String,
|
||||||
accessToken: Password
|
accessToken: Password
|
||||||
) extends Channel {
|
) extends Channel {
|
||||||
val channelType = ChannelType.Matrix
|
val channelType: ChannelType = ChannelType.Matrix
|
||||||
def fold[A](
|
def fold[A](
|
||||||
f1: Mail => A,
|
f1: Mail => A,
|
||||||
f2: Gotify => A,
|
f2: Gotify => A,
|
||||||
@ -101,7 +102,7 @@ object Channel {
|
|||||||
|
|
||||||
final case class Http(id: Ident, name: Option[String], url: LenientUri)
|
final case class Http(id: Ident, name: Option[String], url: LenientUri)
|
||||||
extends Channel {
|
extends Channel {
|
||||||
val channelType = ChannelType.Http
|
val channelType: ChannelType = ChannelType.Http
|
||||||
def fold[A](
|
def fold[A](
|
||||||
f1: Mail => A,
|
f1: Mail => A,
|
||||||
f2: Gotify => A,
|
f2: Gotify => A,
|
||||||
|
@ -24,9 +24,9 @@ import docspell.store.Store
|
|||||||
import docspell.store.records.RInternalSetting
|
import docspell.store.records.RInternalSetting
|
||||||
|
|
||||||
import org.http4s._
|
import org.http4s._
|
||||||
import org.http4s.blaze.client.BlazeClientBuilder
|
|
||||||
import org.http4s.blaze.server.BlazeServerBuilder
|
import org.http4s.blaze.server.BlazeServerBuilder
|
||||||
import org.http4s.dsl.Http4sDsl
|
import org.http4s.dsl.Http4sDsl
|
||||||
|
import org.http4s.ember.client.EmberClientBuilder
|
||||||
import org.http4s.headers.Location
|
import org.http4s.headers.Location
|
||||||
import org.http4s.implicits._
|
import org.http4s.implicits._
|
||||||
import org.http4s.server.Router
|
import org.http4s.server.Router
|
||||||
@ -83,7 +83,7 @@ object RestServer {
|
|||||||
(RestApp[F], NaivePubSub[F], RInternalSetting)
|
(RestApp[F], NaivePubSub[F], RInternalSetting)
|
||||||
] =
|
] =
|
||||||
for {
|
for {
|
||||||
httpClient <- BlazeClientBuilder[F].resource
|
httpClient <- EmberClientBuilder.default[F].build
|
||||||
store <- Store.create[F](
|
store <- Store.create[F](
|
||||||
cfg.backend.jdbc,
|
cfg.backend.jdbc,
|
||||||
cfg.backend.databaseSchema,
|
cfg.backend.databaseSchema,
|
||||||
|
@ -239,7 +239,7 @@ object Dependencies {
|
|||||||
val fs2 = fs2Core ++ fs2Io
|
val fs2 = fs2Core ++ fs2Io
|
||||||
|
|
||||||
val http4sClient = Seq(
|
val http4sClient = Seq(
|
||||||
"org.http4s" %% "http4s-blaze-client" % "0.23.14"
|
"org.http4s" %% "http4s-ember-client" % Http4sVersion
|
||||||
)
|
)
|
||||||
|
|
||||||
val http4sCirce = Seq(
|
val http4sCirce = Seq(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user