INNER CODE UNIT · Rust

Err

ovexro/dockpanel · panel/agent/src/routes/mod.rs:227

    if let Err(e) = std::fs::write(&tmp_path, &new_token) {
        tracing::error!("Failed to write temp token file: {e}");
        return Err(StatusCode::INTERNAL_SERVER_ERROR);
    }
    if let Err(e) = std::fs::rename(&tmp_path, &token_path) {
        tracing::error!("Failed to rename token file: {e}");
        return Err(StatusCode::INTERNAL_SERVER_ERROR);
    }
    #[cfg(unix)]
    {
        use std::os::unix::fs::PermissionsExt;
        std::fs::set_permissions(&token_path, std::fs::Permissions::from_mode(0o600)).ok();
    }

    // Update in-memory token
    {
        let mut current = state.token.write().await;
        *current = new_token.clone();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…