Replace Rocket and Tera with Rouille and Maud #88
|
@ -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,
|
||||
|
|
|
@ -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<dyn std::error::Error>;
|
||||
|
@ -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<Theme> = 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.
|
||||
|
|
Loading…
Reference in New Issue