mirror of
https://github.com/Xevion/Pac-Man.git
synced 2026-01-31 04:25:07 -06:00
feat: initial server config & Dockerfile
This commit is contained in:
@@ -1,3 +1,23 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
use axum::Router;
|
||||
|
||||
use crate::config::Config;
|
||||
|
||||
mod config;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
// Load environment variables
|
||||
#[cfg(debug_assertions)]
|
||||
dotenvy::from_path(format!("{}.env", env!("CARGO_MANIFEST_DIR"))).ok();
|
||||
#[cfg(not(debug_assertions))]
|
||||
dotenvy::dotenv().ok();
|
||||
|
||||
// Load configuration
|
||||
let config: Config = config::load_config();
|
||||
|
||||
let app = Router::new().fallback(|| async { "Hello, World!" });
|
||||
|
||||
let addr = std::net::SocketAddr::new(config.host, config.port);
|
||||
let listener = tokio::net::TcpListener::bind(addr).await.unwrap();
|
||||
axum::serve(listener, app).await.unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user