huskies: merge 1179 story Token-authenticated sled→gateway WS uplink (remote-gateway ready)
This commit is contained in:
+20
-7
@@ -270,13 +270,9 @@ async fn main() -> Result<(), std::io::Error> {
|
||||
crate::crdt_state::write_llm_session(&services.bot_name.to_lowercase(), "all");
|
||||
|
||||
// Sled uplink: forward permission requests to an upstream gateway when configured.
|
||||
let upstream_gateway = cli
|
||||
.upstream_gateway
|
||||
.clone()
|
||||
.or_else(|| std::env::var("HUSKIES_UPSTREAM_GATEWAY").ok())
|
||||
.unwrap_or_default();
|
||||
// Project name for the identity frame (story 899 AC 5). Env-var override
|
||||
// wins; otherwise derive from the project_root basename.
|
||||
// Project name for the identity frame (story 899 AC 5) and for the
|
||||
// derived uplink URL below (story 1179 AC 4). Env-var override wins;
|
||||
// otherwise derive from the project_root basename.
|
||||
let project_name = std::env::var("HUSKIES_PROJECT_NAME").unwrap_or_else(|_| {
|
||||
services
|
||||
.project_root
|
||||
@@ -285,12 +281,29 @@ async fn main() -> Result<(), std::io::Error> {
|
||||
.unwrap_or("unknown")
|
||||
.to_string()
|
||||
});
|
||||
// Explicit `--upstream-gateway`/`HUSKIES_UPSTREAM_GATEWAY` (a full WS URL,
|
||||
// possibly with a legacy `?token=`) takes precedence; otherwise derive the
|
||||
// uplink URL from `HUSKIES_GATEWAY_URL` (story 1179 AC 4).
|
||||
let upstream_gateway = cli
|
||||
.upstream_gateway
|
||||
.clone()
|
||||
.or_else(|| std::env::var("HUSKIES_UPSTREAM_GATEWAY").ok())
|
||||
.or_else(|| {
|
||||
std::env::var("HUSKIES_GATEWAY_URL")
|
||||
.ok()
|
||||
.map(|gateway_url| sled_uplink::build_uplink_url(&gateway_url, &project_name))
|
||||
})
|
||||
.unwrap_or_default();
|
||||
// Shared-secret sent as `Authorization: Bearer <token>` on the uplink
|
||||
// upgrade request (story 1179 AC 1).
|
||||
let sled_auth_token = std::env::var("HUSKIES_SLED_TOKEN").ok();
|
||||
let local_mcp_url = format!("http://127.0.0.1:{port}/mcp");
|
||||
sled_uplink::spawn_uplink_task(
|
||||
sled_uplink::UplinkConfig {
|
||||
upstream_url: upstream_gateway,
|
||||
project_name,
|
||||
local_mcp_url,
|
||||
auth_token: sled_auth_token,
|
||||
},
|
||||
Arc::clone(&services),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user