Remove VFS references from web

This commit is contained in:
Lucien Greathouse 2018-04-05 17:11:36 -07:00
parent 1d84c8013e
commit 203b9e1fb6
2 changed files with 1 additions and 33 deletions

View file

@ -1,13 +1,10 @@
use std::path::{Path, PathBuf}; use std::path::PathBuf;
use std::process; use std::process;
use std::time::Instant; use std::time::Instant;
use rand; use rand;
use project::{Project, ProjectLoadError}; use project::{Project, ProjectLoadError};
use middleware::{MiddlewareChain};
use middlewares::{DefaultMiddleware, JsonModelMiddleware, ScriptMiddleware};
use vfs::{VfsSession};
use web; use web;
pub fn serve(project_path: &PathBuf, verbose: bool, port: Option<u64>) { pub fn serve(project_path: &PathBuf, verbose: bool, port: Option<u64>) {
@ -57,34 +54,6 @@ pub fn serve(project_path: &PathBuf, verbose: bool, port: Option<u64>) {
server_id, server_id,
}; };
lazy_static! {
static ref PLUGIN_CHAIN: MiddlewareChain = MiddlewareChain::new(vec![
Box::new(ScriptMiddleware::new()),
Box::new(JsonModelMiddleware::new()),
Box::new(DefaultMiddleware::new()),
]);
}
let vfs = {
let mut vfs = VfsSession::new(&PLUGIN_CHAIN);
for (name, project_partition) in &project.partitions {
let path = {
let given_path = Path::new(&project_partition.path);
if given_path.is_absolute() {
given_path.to_path_buf()
} else {
project_path.join(given_path)
}
};
vfs.insert_partition(name, path);
}
Arc::new(Mutex::new(vfs))
};
println!("Server listening on port {}", web_config.port); println!("Server listening on port {}", web_config.port);
web::start(web_config, project.clone(), Instant::now()); web::start(web_config, project.clone(), Instant::now());

View file

@ -1,4 +1,3 @@
use std::sync::{Arc, Mutex};
use std::time::Instant; use std::time::Instant;
use rouille; use rouille;