Allow to configure some http server details

This commit is contained in:
eikek
2022-03-19 00:19:27 +01:00
parent e3ed0ba24d
commit 57bcea7ae3
4 changed files with 50 additions and 1 deletions

View File

@ -38,6 +38,17 @@ docspell.server {
port = 7880
}
# Options for tuning the http server
server-options {
enable-http-2 = false
# Maximum allowed connections
max-connections = 1024
# Timeout for waiting for the first output of the response
response-timeout = 45s
}
# This is a hard limit to restrict the size of a batch that is
# returned when searching for items. The user can set this limit
# within the client config, but it is restricted by the server to

View File

@ -13,7 +13,7 @@ import docspell.ftssolr.SolrConfig
import docspell.logging.LogConfig
import docspell.oidc.ProviderConfig
import docspell.pubsub.naive.PubSubConfig
import docspell.restserver.Config.OpenIdConfig
import docspell.restserver.Config.{OpenIdConfig, ServerOptions}
import docspell.restserver.auth.OpenId
import docspell.restserver.http4s.InternalHeader
@ -26,6 +26,7 @@ case class Config(
internalUrl: LenientUri,
logging: LogConfig,
bind: Config.Bind,
serverOptions: ServerOptions,
backend: BackendConfig,
auth: Login.Config,
showClassificationSettings: Boolean,
@ -50,6 +51,11 @@ case class Config(
object Config {
case class ServerOptions(
responseTimeout: Duration,
enableHttp2: Boolean,
maxConnections: Int
)
case class Bind(address: String, port: Int)
case class AdminEndpoint(secret: String)

View File

@ -52,6 +52,9 @@ object RestServer {
BlazeServerBuilder[F]
.bindHttp(cfg.bind.port, cfg.bind.address)
.withoutBanner
.withResponseHeaderTimeout(cfg.serverOptions.responseTimeout.toScala)
.enableHttp2(cfg.serverOptions.enableHttp2)
.withMaxConnections(cfg.serverOptions.maxConnections)
.withHttpWebSocketApp(
createHttpApp(setting, pubSub, restApp)
)