Files
gitks/main.rs
T
zhenyi f0a443932a feat(server): add gitks gRPC server with environment configuration
- Add dotenvy dependency for environment variable loading
- Integrate tracing-subscriber for structured logging
- Create main.rs entry point with async server initialization
- Implement environment-based host and port configuration
- Set default address to 0.0.0:50051 for gRPC server
- Add proper error handling with Box<dyn std::error::Error>
2026-06-04 14:10:29 +08:00

17 lines
579 B
Rust

use gitks::server::serve;
const DEFAULT_HOST: &str = "0.0.0.0";
const DEFAULT_PORT: &str = "50051";
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
dotenvy::dotenv().ok();
tracing_subscriber::fmt::init();
let host = std::env::var("GITKS_HOST").unwrap_or_else(|_| DEFAULT_HOST.into());
let port = std::env::var("GITKS_PORT").unwrap_or_else(|_| DEFAULT_PORT.into());
let addr: std::net::SocketAddr = format!("{host}:{port}").parse()?;
tracing::info!("starting gitks gRPC server on {addr}");
serve(addr).await?;
Ok(())
}