usesVpn()) { info("Mode VPN détecté - connexion directe à la base"); return $db; } // Mode tunnel SSH info("Mode tunnel SSH - ouverture du tunnel..."); $tunnelScript = __DIR__ . '/../bin/_ssh-tunnel.sh'; exec("$tunnelScript open $environment 2>&1", $output, $exitCode); if ($exitCode !== 0) { error("Impossible d'ouvrir le tunnel SSH"); if (!empty($output)) { foreach ($output as $line) { error(" " . $line); } } throw new RuntimeException("Échec de l'ouverture du tunnel SSH"); } return $db; }