Template
feat: Moved app port to config
This commit is contained in:
1 parent
d267d1c6c1
commit
dd22946dad
3 files changed
+5
-3
No files matched your search
+3
-3
@@ -12,11 +12,11 @@ async fn main() {
|
||||
let config: Config = get_app_config().expect("Unable to read app config");
|
||||
|
||||
// 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();
|
||||
println!("Listening on http://localhost:7878");
|
||||
println!("Listening on http://localhost:{}", &config.port);
|
||||
|
||||
axum::serve(listener, app).await.unwrap();
|
||||
}
|
||||
@@ -3,6 +3,7 @@ use serde::Deserialize;
|
||||
#[derive(Clone, Deserialize)]
|
||||
pub struct Config {
|
||||
pub metadata: SiteMetadata,
|
||||
pub port: i16,
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize)]
|
||||
|
||||
Reference in new issue
Block a user