feat: Make stub proxy target derive from MCP_PORT env var
This commit is contained in:
1 parent
ce17ffcf42
commit
c9ba5e79dd
1 file changed
+6
-1
+6
-1
@@ -80,7 +80,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
let _ = shutdown_tx.send(()).await;
|
let _ = shutdown_tx.send(()).await;
|
||||||
});
|
});
|
||||||
|
|
||||||
let target_url = cli.target;
|
let target_url = if cli.target != "http://localhost:3000" {
|
||||||
|
cli.target
|
||||||
|
} else {
|
||||||
|
let port = std::env::var("MCP_PORT").unwrap_or_else(|_| "3000".to_string());
|
||||||
|
format!("http://127.0.0.1:{}", port)
|
||||||
|
};
|
||||||
let ws_url = target_url.replace("http://", "ws://").replace("https://", "wss://");
|
let ws_url = target_url.replace("http://", "ws://").replace("https://", "wss://");
|
||||||
let ws_url = format!("{}/ws?client=proxy", ws_url);
|
let ws_url = format!("{}/ws?client=proxy", ws_url);
|
||||||
let msg_rx = Arc::new(tokio::sync::Mutex::new(msg_rx));
|
let msg_rx = Arc::new(tokio::sync::Mutex::new(msg_rx));
|
||||||
|
|||||||
Reference in new issue
Block a user