rmap/commands/
serve.rs

1use clap::Parser;
2use serde::{Deserialize, Serialize};
3use tracing::info;
4
5use crate::commands::Command;
6
7#[derive(Parser, Serialize, Deserialize)]
8pub struct ServeCommand {
9    /// gRPC server address to bind to (default: [::]:50051)
10    #[arg(short = 'a', long, default_value = "[::]:50051")]
11    pub addr: String,
12}
13
14impl Command for ServeCommand {
15    async fn run(&self) -> Result<(), String> {
16        info!("Starting rmap gRPC server on {}", self.addr);
17
18        remote::start_server(&self.addr)
19            .await
20            .map_err(|e| format!("Failed to start server: {}", e))?;
21
22        Ok(())
23    }
24}