feat: Moved app port to config

This commit is contained in:
Cyper committed 2026-02-28 03:08:07 -05:00
1 parent d267d1c6c1
commit dd22946dad
3 files changed
+5 -3

No files matched your search

+1
View File
@@ -12,6 +12,7 @@ toml = "1.0.3"
tower-http = { version = "0.6.8", features = ["fs", "trace"] } tower-http = { version = "0.6.8", features = ["fs", "trace"] }
[app] [app]
port = 7878
[app.metadata] [app.metadata]
author = "Cyper" author = "Cyper"
+3 -3
View File
@@ -12,11 +12,11 @@ async fn main() {
let config: Config = get_app_config().expect("Unable to read app config"); let config: Config = get_app_config().expect("Unable to read app config");
// Build app with shared state // Build app with shared state
let app = app::app().with_state(config); let app = app::app().with_state(config.clone());
let app_ip = "0.0.0.0:7878"; let app_ip = format!("0.0.0.0:{}", config.port);
let listener = tokio::net::TcpListener::bind(&app_ip).await.unwrap(); let listener = tokio::net::TcpListener::bind(&app_ip).await.unwrap();
println!("Listening on http://localhost:7878"); println!("Listening on http://localhost:{}", &config.port);
axum::serve(listener, app).await.unwrap(); axum::serve(listener, app).await.unwrap();
} }
+1
View File
@@ -3,6 +3,7 @@ use serde::Deserialize;
#[derive(Clone, Deserialize)] #[derive(Clone, Deserialize)]
pub struct Config { pub struct Config {
pub metadata: SiteMetadata, pub metadata: SiteMetadata,
pub port: i16,
} }
#[derive(Clone, Deserialize)] #[derive(Clone, Deserialize)]