refactor(#2352): route hivectl github set-token through a daemon wire command
This commit is contained in:
parent
756e850681
commit
6c654921a0
3 changed files with 49 additions and 14 deletions
|
|
@ -196,6 +196,9 @@ async fn dispatch(req: &HostRequest, coord: Arc<Coordinator>) -> HostResponse {
|
|||
HostRequest::ForgeCreateUser { name, password } => {
|
||||
handle_forge_create_user(name, password.as_deref()).await?
|
||||
}
|
||||
HostRequest::SetAgentGithubToken { agent, token } => {
|
||||
handle_set_agent_github_token(agent, token).await?
|
||||
}
|
||||
})
|
||||
}
|
||||
.await;
|
||||
|
|
@ -395,6 +398,16 @@ async fn handle_forge_create_user(name: &str, password: Option<&str>) -> Result<
|
|||
Ok(HostResponse::messages(out))
|
||||
}
|
||||
|
||||
async fn handle_set_agent_github_token(agent: &str, token: &str) -> Result<HostResponse> {
|
||||
crate::priv_client::write_agent_github_token(agent, token)
|
||||
.await
|
||||
.with_context(|| format!("write github-token for agent {agent}"))?;
|
||||
Ok(HostResponse::messages(vec![format!(
|
||||
"wrote github-token for agent '{agent}' \
|
||||
(read live by the gh wrapper / git credential helper — no rebuild needed)"
|
||||
)]))
|
||||
}
|
||||
|
||||
async fn handle_matrix_sync_admin() -> Result<HostResponse> {
|
||||
require_matrix_present().await?;
|
||||
let register_token =
|
||||
|
|
|
|||
Loading…
Reference in a new issue