Replace http4s-blaze-server with http4s-ember-server.

This commit is contained in:
Rehan Mahmood
2023-10-24 17:58:21 -04:00
parent f7f93c5b2a
commit 343d5575e4
9 changed files with 46 additions and 28 deletions

View File

@ -27,6 +27,8 @@ import docspell.pubsub.naive.PubSubConfig
import docspell.scheduler.{PeriodicSchedulerConfig, SchedulerConfig}
import docspell.store.{JdbcConfig, SchemaMigrateConfig}
import com.comcast.ip4s.{Host, Port}
case class Config(
appId: Ident,
baseUrl: LenientUri,
@ -59,7 +61,7 @@ case class Config(
}
object Config {
case class Bind(address: String, port: Int)
case class Bind(address: Host, port: Port)
case class ScanMailbox(maxFolders: Int, mailChunkSize: Int, maxMails: Int) {
def mailBatchSize: Int =

View File

@ -18,6 +18,7 @@ import emil.MailAddress
import emil.javamail.syntax._
import pureconfig._
import pureconfig.generic.auto._
import pureconfig.module.ip4s._
import yamusca.imports._
object ConfigFile {

View File

@ -6,7 +6,6 @@
package docspell.joex
import cats.effect.Ref
import cats.effect._
import fs2.Stream
import fs2.concurrent.SignallingRef
@ -19,8 +18,8 @@ import docspell.store.Store
import docspell.store.records.RInternalSetting
import org.http4s.HttpApp
import org.http4s.blaze.server.BlazeServerBuilder
import org.http4s.ember.client.EmberClientBuilder
import org.http4s.ember.server.EmberServerBuilder
import org.http4s.implicits._
import org.http4s.server.Router
import org.http4s.server.middleware.Logger
@ -70,13 +69,15 @@ object JoexServer {
Stream
.resource(app)
.flatMap(app =>
BlazeServerBuilder[F]
.bindHttp(cfg.bind.port, cfg.bind.address)
.withHttpApp(app.httpApp)
.withoutBanner
.serveWhile(app.termSig, app.exitRef)
)
.flatMap { app =>
Stream.resource {
EmberServerBuilder
.default[F]
.withHost(cfg.bind.address)
.withPort(cfg.bind.port)
.withHttpApp(app.httpApp)
.build
}
}
}.drain
}