@@ -21,9 +21,13 @@ package org.eclipse.apoapsis.ortserver.secrets.vault
2121
2222import com.typesafe.config.Config
2323
24+ import kotlin.time.Duration
25+ import kotlin.time.Duration.Companion.seconds
26+
2427import org.eclipse.apoapsis.ortserver.config.ConfigManager
2528import org.eclipse.apoapsis.ortserver.config.Path
2629import org.eclipse.apoapsis.ortserver.secrets.vault.model.VaultCredentials
30+ import org.eclipse.apoapsis.ortserver.utils.config.getLongOrDefault
2731import org.eclipse.apoapsis.ortserver.utils.config.getStringOrNull
2832
2933/* *
@@ -54,7 +58,10 @@ data class VaultConfiguration(
5458 * of multiple tenants. In an environment that uses namespaces, it is necessary to pass the target namespace as
5559 * a header when sending requests to the Vault service. If this property is not *null*, such a header is added.
5660 */
57- val namespace : String? = null
61+ val namespace : String? = null ,
62+
63+ /* * The timeout to be applied to all HTTP requests against the Vault service. */
64+ val timeout : Duration = DEFAULT_TIMEOUT
5865) {
5966 companion object {
6067 /* * Name of the configuration property for the URI of the Vault service. */
@@ -75,9 +82,15 @@ data class VaultConfiguration(
7582 /* * Name of the configuration property defining the namespace to be passed to the vault service. */
7683 private const val NAMESPACE_PROPERTY = " vaultNamespace"
7784
85+ /* * Name of the configuration property defining the timeout for HTTP requests in seconds. */
86+ private const val TIMEOUT_PROPERTY = " vaultHttpTimeoutSec"
87+
7888 /* * The default path prefix under which the KV Secrets Engine is available. */
7989 private const val DEFAULT_PREFIX = " secret"
8090
91+ /* * The default timeout for HTTP requests to the Vault service. */
92+ val DEFAULT_TIMEOUT = 10 .seconds
93+
8194 /* * The separator for hierarchical paths. */
8295 private const val PATH_SEPARATOR = " /"
8396
@@ -92,7 +105,8 @@ data class VaultConfiguration(
92105 ),
93106 rootPath = getOptionalRootPath(configManager),
94107 prefix = getOptionalPrefix(configManager),
95- namespace = configManager.getStringOrNull(NAMESPACE_PROPERTY )
108+ namespace = configManager.getStringOrNull(NAMESPACE_PROPERTY ),
109+ timeout = configManager.getLongOrDefault(TIMEOUT_PROPERTY , DEFAULT_TIMEOUT .inWholeSeconds).seconds
96110 )
97111
98112 /* *
0 commit comments