diff --git a/config.toml b/config.toml index 67e263f..ee12a78 100644 --- a/config.toml +++ b/config.toml @@ -1,2 +1,3 @@ [settings] base_directory = "/strg/drw" +bind_address = "127.0.0.1:3012" diff --git a/src/config.rs b/src/config.rs index bd12240..2cbec46 100644 --- a/src/config.rs +++ b/src/config.rs @@ -10,6 +10,7 @@ pub struct Config { #[derive(Deserialize)] pub struct Settings { pub base_directory: String, + pub bind_address: String, } pub fn read_config() -> Result> { diff --git a/src/handlers.rs b/src/handlers.rs index 8bbf2fa..7f11995 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -15,6 +15,7 @@ pub async fn list_files( let template = ListTemplate { files: files.to_vec(), }; + HtmlTemplate(template) } diff --git a/src/main.rs b/src/main.rs index f12b1fb..2bdec74 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,7 +30,9 @@ async fn main() { ) .with_state(files); - let listener = TcpListener::bind("127.0.0.1:3004").await.unwrap(); + let listener = TcpListener::bind(config.settings.bind_address) + .await + .unwrap(); println!("Listening on {}", listener.local_addr().unwrap()); axum::serve(listener, app).await.unwrap();