1
0
forked from boos/BoosAPI

feat(pixelle): 连接凭证 admin 端点(GET/PUT 掩码 + 重启)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
boos
2026-06-18 11:57:23 +08:00
parent 55188e51ff
commit 92d38bb309
3 changed files with 88 additions and 0 deletions
+16
View File
@@ -71,6 +71,22 @@ pub fn sync_to_pixelle(config_path: &str, conn: &PixelleConnection) -> AppResult
Ok(backup)
}
pub async fn restart_pixelle(compose_dir: &str) -> AppResult<()> {
let output = tokio::process::Command::new("docker")
.args(["compose", "restart", "api"])
.current_dir(compose_dir)
.output()
.await
.map_err(|e| AppError::ServiceUnavailable(format!("docker compose restart 启动失败: {e}")))?;
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
return Err(AppError::ServiceUnavailable(format!(
"Pixelle 重启失败: {}", stderr.trim()
)));
}
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;