mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Allow to configure some http server details
This commit is contained in:
@ -38,6 +38,17 @@ docspell.server {
|
|||||||
port = 7880
|
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
|
# 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
|
# returned when searching for items. The user can set this limit
|
||||||
# within the client config, but it is restricted by the server to
|
# within the client config, but it is restricted by the server to
|
||||||
|
@ -13,7 +13,7 @@ import docspell.ftssolr.SolrConfig
|
|||||||
import docspell.logging.LogConfig
|
import docspell.logging.LogConfig
|
||||||
import docspell.oidc.ProviderConfig
|
import docspell.oidc.ProviderConfig
|
||||||
import docspell.pubsub.naive.PubSubConfig
|
import docspell.pubsub.naive.PubSubConfig
|
||||||
import docspell.restserver.Config.OpenIdConfig
|
import docspell.restserver.Config.{OpenIdConfig, ServerOptions}
|
||||||
import docspell.restserver.auth.OpenId
|
import docspell.restserver.auth.OpenId
|
||||||
import docspell.restserver.http4s.InternalHeader
|
import docspell.restserver.http4s.InternalHeader
|
||||||
|
|
||||||
@ -26,6 +26,7 @@ case class Config(
|
|||||||
internalUrl: LenientUri,
|
internalUrl: LenientUri,
|
||||||
logging: LogConfig,
|
logging: LogConfig,
|
||||||
bind: Config.Bind,
|
bind: Config.Bind,
|
||||||
|
serverOptions: ServerOptions,
|
||||||
backend: BackendConfig,
|
backend: BackendConfig,
|
||||||
auth: Login.Config,
|
auth: Login.Config,
|
||||||
showClassificationSettings: Boolean,
|
showClassificationSettings: Boolean,
|
||||||
@ -50,6 +51,11 @@ case class Config(
|
|||||||
|
|
||||||
object Config {
|
object Config {
|
||||||
|
|
||||||
|
case class ServerOptions(
|
||||||
|
responseTimeout: Duration,
|
||||||
|
enableHttp2: Boolean,
|
||||||
|
maxConnections: Int
|
||||||
|
)
|
||||||
case class Bind(address: String, port: Int)
|
case class Bind(address: String, port: Int)
|
||||||
|
|
||||||
case class AdminEndpoint(secret: String)
|
case class AdminEndpoint(secret: String)
|
||||||
|
@ -52,6 +52,9 @@ object RestServer {
|
|||||||
BlazeServerBuilder[F]
|
BlazeServerBuilder[F]
|
||||||
.bindHttp(cfg.bind.port, cfg.bind.address)
|
.bindHttp(cfg.bind.port, cfg.bind.address)
|
||||||
.withoutBanner
|
.withoutBanner
|
||||||
|
.withResponseHeaderTimeout(cfg.serverOptions.responseTimeout.toScala)
|
||||||
|
.enableHttp2(cfg.serverOptions.enableHttp2)
|
||||||
|
.withMaxConnections(cfg.serverOptions.maxConnections)
|
||||||
.withHttpWebSocketApp(
|
.withHttpWebSocketApp(
|
||||||
createHttpApp(setting, pubSub, restApp)
|
createHttpApp(setting, pubSub, restApp)
|
||||||
)
|
)
|
||||||
|
@ -21,6 +21,11 @@ let
|
|||||||
address = "localhost";
|
address = "localhost";
|
||||||
port = 7880;
|
port = 7880;
|
||||||
};
|
};
|
||||||
|
server-options = {
|
||||||
|
enable-http-2 = false;
|
||||||
|
max-connections = 1024;
|
||||||
|
response-timeout = "45s";
|
||||||
|
};
|
||||||
logging = {
|
logging = {
|
||||||
minimum-level = "Info";
|
minimum-level = "Info";
|
||||||
format = "Fancy";
|
format = "Fancy";
|
||||||
@ -214,6 +219,30 @@ in {
|
|||||||
description = "Address and port bind the rest server.";
|
description = "Address and port bind the rest server.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
server-options = mkOption {
|
||||||
|
type = types.submodule({
|
||||||
|
options = {
|
||||||
|
enable-http-2 = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = defaults.server-options.enable-http-2;
|
||||||
|
description = "Whether to enable http2";
|
||||||
|
};
|
||||||
|
max-connections = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = defaults.server-options.max-connections;
|
||||||
|
description = "Maximum number of client connections";
|
||||||
|
};
|
||||||
|
response-timeout = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = defaults.server-options.response-timeout;
|
||||||
|
description = "Timeout when waiting for the response.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
default = defaults.server-options;
|
||||||
|
description = "Tuning the http server";
|
||||||
|
};
|
||||||
|
|
||||||
logging = mkOption {
|
logging = mkOption {
|
||||||
type = types.submodule({
|
type = types.submodule({
|
||||||
options = {
|
options = {
|
||||||
|
Reference in New Issue
Block a user