huskies: merge 1229 bug Explicit project arg ignored on the SSE MCP path — 1225's routing and create-guard are bypassed
This commit is contained in:
@@ -361,6 +361,28 @@ impl GatewayState {
|
||||
})
|
||||
}
|
||||
|
||||
/// Get the URL of an explicitly named project (story 1229), without
|
||||
/// reading or mutating `active_project`.
|
||||
///
|
||||
/// Returns `Err` when the project is unknown or has no URL configured
|
||||
/// (WS-uplink only) — mirrors [`GatewayState::active_url`]'s error shape
|
||||
/// so callers can format both the same way.
|
||||
pub async fn url_for_project(&self, project: &str) -> Result<String, Error> {
|
||||
self.projects
|
||||
.read()
|
||||
.await
|
||||
.get(project)
|
||||
.ok_or_else(|| Error::ProjectNotFound(format!("unknown project '{project}'")))?
|
||||
.url
|
||||
.clone()
|
||||
.ok_or_else(|| {
|
||||
Error::ProjectNotFound(format!(
|
||||
"project '{project}' has no URL configured \
|
||||
(use sled-uplink WS or add url to projects.toml)"
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
/// Register a live sled connection for the given project.
|
||||
pub async fn register_sled_connection(&self, project_name: String, conn: SledConnection) {
|
||||
self.sled_connections
|
||||
|
||||
Reference in New Issue
Block a user