Add configuration for jetty idle timeout

Pushed-by: Rene Pfeuffer<rene.pfeuffer@cloudogu.com>
Co-authored-by: René Pfeuffer<rene.pfeuffer@cloudogu.com>
Committed-by: René Pfeuffer<rene.pfeuffer@cloudogu.com>
This commit is contained in:
Rene Pfeuffer
2024-02-07 11:13:17 +01:00
parent d8e1f2d739
commit f894d7fe3b
7 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
- type: fixed
description: Added configuration option for idle timeout

View File

@@ -10,6 +10,9 @@ forwardHeadersEnabled: false
## increase http header size for mercurial ## increase http header size for mercurial
httpHeaderSize: 16384 httpHeaderSize: 16384
## set http idle timeout
idleTimeout:
# ssl config - ssl is only evaluated if key store path is set # ssl config - ssl is only evaluated if key store path is set
## path to your cert file ## path to your cert file
https: https:

View File

@@ -10,6 +10,9 @@ forwardHeadersEnabled: false
## increase http header size for mercurial ## increase http header size for mercurial
httpHeaderSize: 16384 httpHeaderSize: 16384
## set http idle timeout
idleTimeout:
# ssl config - ssl is only evaluated if key store path is set # ssl config - ssl is only evaluated if key store path is set
https: https:
## path to your cert file ## path to your cert file

View File

@@ -10,6 +10,9 @@ forwardHeadersEnabled: true
## increase http header size for mercurial ## increase http header size for mercurial
httpHeaderSize: 16384 httpHeaderSize: 16384
## set http idle timeout
idleTimeout:
# ssl config - ssl is only evaluated if key store path is set # ssl config - ssl is only evaluated if key store path is set
https: https:
## path to your cert file ## path to your cert file

View File

@@ -10,6 +10,9 @@ forwardHeadersEnabled: false
## increase http header size for mercurial ## increase http header size for mercurial
httpHeaderSize: 16384 httpHeaderSize: 16384
## set http idle timeout
idleTimeout:
# ssl config - ssl is only evaluated if key store path is set # ssl config - ssl is only evaluated if key store path is set
https: https:
## path to your cert file ## path to your cert file

View File

@@ -37,6 +37,7 @@ public class ServerConfigYaml {
private String tempDir = "work/scm"; private String tempDir = "work/scm";
// Resolves the client ip instead of the reverse proxy ip if the X-Forwarded-For header is present // Resolves the client ip instead of the reverse proxy ip if the X-Forwarded-For header is present
private boolean forwardHeadersEnabled = false; private boolean forwardHeadersEnabled = false;
private int idleTimeout = 0;
// ### SSL-related config // ### SSL-related config
// Only configure SSL if the key store path is set // Only configure SSL if the key store path is set
@@ -149,6 +150,14 @@ public class ServerConfigYaml {
this.forwardHeadersEnabled = forwardHeadersEnabled; this.forwardHeadersEnabled = forwardHeadersEnabled;
} }
public int getIdleTimeout() {
return getEnvWithDefault("IDLE_TIMEOUT", idleTimeout);
}
public void setIdleTimeout(int idleTimeout) {
this.idleTimeout = idleTimeout;
}
static int getEnvWithDefault(String envKey, int configValue) { static int getEnvWithDefault(String envKey, int configValue) {
String value = getEnv(envKey); String value = getEnv(envKey);
return value != null ? Integer.parseInt(value) : configValue; return value != null ? Integer.parseInt(value) : configValue;

View File

@@ -118,6 +118,10 @@ public final class ServerConfiguration {
connector.setHost(configYaml.getAddressBinding()); connector.setHost(configYaml.getAddressBinding());
System.out.println("Set http port to " + configYaml.getPort()); System.out.println("Set http port to " + configYaml.getPort());
connector.setPort(configYaml.getPort()); connector.setPort(configYaml.getPort());
if (configYaml.getIdleTimeout() > 0) {
System.out.println("Set http idle timeout to " + configYaml.getIdleTimeout());
connector.setIdleTimeout(configYaml.getIdleTimeout());
}
server.addConnector(connector); server.addConnector(connector);
} }