Beginning of data persistence module.

This commit is contained in:
Grégory Burri 2019-08-29 14:03:24 +02:00
parent c012be04a9
commit 87bc628b56
3 changed files with 42 additions and 2 deletions

View file

@ -15,6 +15,7 @@ use std::{fs::File, env::args};
use itertools::Itertools;
mod consts;
mod db;
#[derive(Template)]
#[template(path = "main.html")]
@ -61,6 +62,8 @@ fn main() -> std::io::Result<()> {
println!("Configuration: {:?}", config);
let database_connection = db::create_or_update();
let mut listenfd = ListenFd::from_env();
let mut server =
HttpServer::new(
@ -86,7 +89,7 @@ fn main() -> std::io::Result<()> {
fn process_args() -> bool {
fn print_usage() {
println!("Usage:");
println!(" {} [--help]", get_exe_name());
println!(" {} [--help] [--test]", get_exe_name());
}
let args: Vec<String> = args().collect();
@ -94,6 +97,9 @@ fn process_args() -> bool {
if args.iter().any(|arg| arg == "--help") {
print_usage();
return true
} else if args.iter().any(|arg| arg == "--test") {
let database_connection = db::create_or_update();
return true
}
false