converted main library module to a more structural architecture
This commit is contained in:
parent
b95003257d
commit
3c9f92a1ab
5 changed files with 80 additions and 38 deletions
|
@ -1,6 +1,6 @@
|
|||
use super::config::Configuration;
|
||||
use super::database::DbManager;
|
||||
use super::http::serve;
|
||||
use super::http::HttpManager;
|
||||
use super::log::Logger;
|
||||
|
||||
///
|
||||
|
@ -8,7 +8,26 @@ use super::log::Logger;
|
|||
///
|
||||
pub fn main() {
|
||||
let configuration = Configuration::read();
|
||||
Logger::configure(&configuration);
|
||||
let mut db_manager = DbManager::new(&configuration);
|
||||
serve(&configuration, &mut db_manager);
|
||||
}
|
||||
|
||||
pub struct Harsh {
|
||||
db_manager: DbManager,
|
||||
logger: Logger,
|
||||
http_manager: HttpManager,
|
||||
}
|
||||
|
||||
impl Harsh {
|
||||
pub fn new(configuration: Configuration) -> Self {
|
||||
let db_manager = DbManager::new(&configuration);
|
||||
let logger = Logger::new(&configuration);
|
||||
let http_manager = HttpManager::new();
|
||||
|
||||
Harsh {
|
||||
logger,
|
||||
db_manager,
|
||||
http_manager,
|
||||
}
|
||||
}
|
||||
|
||||
fn serve(&mut self) {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue