diff --git a/peach-web/src/config.rs b/peach-web/src/config.rs index 00d7239..7fd85ad 100644 --- a/peach-web/src/config.rs +++ b/peach-web/src/config.rs @@ -6,7 +6,7 @@ use std::io::{self, BufRead}; use std::path::Path; // Ini-like key=value configuration with global config only (no subsections). -#[derive(Debug)] +#[derive(Debug, PartialEq)] pub struct Config { pub disable_auth: bool, pub standalone_mode: bool, diff --git a/peach-web/src/main.rs b/peach-web/src/main.rs index 7389d1a..e86c2f5 100644 --- a/peach-web/src/main.rs +++ b/peach-web/src/main.rs @@ -13,9 +13,10 @@ //! CSS. //mod context; +mod config; pub mod error; //mod router; -//pub mod routes; +mod routes; //#[cfg(test)] //mod tests; mod templates; @@ -31,6 +32,8 @@ use log::info; use rouille::{router, Response}; +// crate-local dependencies +use config::Config; use utils::Theme; pub type BoxError = Box; @@ -49,7 +52,10 @@ pub struct RocketConfig { } */ +static CONFIG_PATH: &str = "./config"; + lazy_static! { + static ref CONFIG: Config = Config::from_file(CONFIG_PATH).expect("failed to read config file"); static ref THEME: RwLock = RwLock::new(Theme::Light); } @@ -119,7 +125,11 @@ fn main() { router!(request, (GET) (/) => { - Response::html(templates::home::build()) + Response::html(routes::home::build()) + }, + + (GET) (/settings) => { + Response::html(routes::settings::menu::build()) }, // The code block is called if none of the other blocks matches the request.