feat(vaults): add configurable network timeout for remote vaults

Default 10s on API/HTTP vault requests, overridable per-vault (`timeout:`) or globally (`vault_timeout`); previously they could hang indefinitely on an unreachable host.
This commit is contained in:
imSp4rky
2026-06-21 20:39:37 -06:00
parent 3f5b5e0fe1
commit ecf0bf41ab
5 changed files with 35 additions and 8 deletions
+4
View File
@@ -1,3 +1,4 @@
import inspect
import logging
import time
from typing import Any, Iterator, Optional, Union
@@ -34,6 +35,9 @@ class Vaults:
module = _MODULES.get(type_)
if not module:
raise ValueError(f"Unable to find vault command by the name '{type_}'.")
# only pass the global default to vaults that declare a timeout param (per-vault config still wins)
if "timeout" not in kwargs and "timeout" in inspect.signature(module).parameters:
kwargs["timeout"] = config.vault_timeout
try:
vault = module(**kwargs)
self.vaults.append(vault)