| 1 | use std::net::SocketAddr; |
| 2 | use std::path::PathBuf; |
| 3 | |
| 4 | use anyhow::{Context, Result}; |
| 5 | use clap::Parser; |
| 6 | use deepseek_app_server::{AppServerOptions, run}; |
| 7 | |
| 8 | #[derive(Debug, Parser)] |
| 9 | #[command( |
| 10 | name = "deepseek-app-server", |
| 11 | about = "Run the DeepSeek app-server transport" |
| 12 | )] |
| 13 | struct Cli { |
| 14 | #[arg(long, default_value = "127.0.0.1")] |
| 15 | host: String, |
| 16 | #[arg(long, default_value_t = 8787)] |
| 17 | port: u16, |
| 18 | #[arg(long)] |
| 19 | config: Option<PathBuf>, |
| 20 | } |
| 21 | |
| 22 | #[tokio::main] |
| 23 | async fn main() -> Result<()> { |
| 24 | let cli = Cli::parse(); |
| 25 | let listen: SocketAddr = format!("{}:{}", cli.host, cli.port) |
| 26 | .parse() |
| 27 | .with_context(|| format!("invalid listen address {}:{}", cli.host, cli.port))?; |
| 28 | run(AppServerOptions { |
| 29 | listen, |
| 30 | config_path: cli.config, |
| 31 | }) |
| 32 | .await |
| 33 | } |
| 34 |