fix: auto-enable raw secure storage fallback in Docker containers

Docker/Linux containers have no DPAPI or native keyring, causing all
wormhole persona/gate/identity endpoints to crash with
SecureStorageError. Detect /.dockerenv and auto-allow raw fallback
so mesh features work out of the box in Docker.
This commit is contained in:
anoracleofra-code
2026-03-26 15:28:44 -06:00
parent 6cf325142e
commit b03dc936df
@@ -189,11 +189,28 @@ def _is_windows() -> bool:
return os.name == "nt"
def _is_docker_container() -> bool:
"""Detect if we're running inside a Docker container."""
if os.path.isfile("/.dockerenv"):
return True
try:
with open("/proc/1/cgroup", "r") as f:
if "docker" in f.read():
return True
except OSError:
pass
return os.environ.get("container") == "docker"
def _raw_fallback_allowed() -> bool:
if _is_windows():
return False
if os.environ.get("PYTEST_CURRENT_TEST"):
return True
# Docker containers have no DPAPI or native keyring — auto-allow raw
# fallback so that Wormhole secure storage works out of the box.
if _is_docker_container():
return True
try:
from services.config import get_settings