diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config.rs | 7 | ||||
-rw-r--r-- | src/main.rs | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/config.rs b/src/config.rs index f10fd08..7146a0b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -2,7 +2,14 @@ pub use config::ConfigError; use serde::Deserialize; #[derive(Deserialize)] +pub struct ServerConfig { + pub host: String, + pub port: u16, +} + +#[derive(Deserialize)] pub struct Config { + pub server: ServerConfig, pub pg: deadpool_postgres::Config, } diff --git a/src/main.rs b/src/main.rs index 0ef80bb..51c2f6d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,7 +19,7 @@ async fn main() -> std::io::Result<()> { .to(|| HttpResponse::Ok().body("Hello from Rust!")), ) }) - .bind("127.0.0.1:8080")? + .bind(format!("{}:{}", config.server.host, config.server.port))? .run() .await } |