chore: home filter
This commit is contained in:
parent
836ab03ccf
commit
80810d30a6
@ -1,4 +1,5 @@
|
|||||||
pub mod h_config;
|
pub mod h_config;
|
||||||
pub mod h_data;
|
pub mod h_data;
|
||||||
pub mod h_defs;
|
pub mod h_defs;
|
||||||
|
pub mod h_home;
|
||||||
pub mod datastores;
|
pub mod datastores;
|
32
src/main.rs
32
src/main.rs
@ -24,7 +24,7 @@ use crate::defs::{DataDBs,CollsData,load_cloud_env};
|
|||||||
use clds::clouds::defs::{
|
use clds::clouds::defs::{
|
||||||
Cloud,
|
Cloud,
|
||||||
};
|
};
|
||||||
use clds::clouds::on_clouds::{make_cloud_cache,run_clouds_check,run_apps_check};
|
use clds::clouds::on_clouds::{env_cloud,make_cloud_cache,run_clouds_check,run_apps_check};
|
||||||
use reqenv::ReqEnv;
|
use reqenv::ReqEnv;
|
||||||
|
|
||||||
// static WEBSERVER: AtomicUsize = AtomicUsize::new(0);
|
// static WEBSERVER: AtomicUsize = AtomicUsize::new(0);
|
||||||
@ -136,26 +136,28 @@ async fn up_web_server(webpos: usize) -> Result<()> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
let mut cloud = Cloud::default();
|
let mut cloud = Cloud::default();
|
||||||
load_cloud_env(&mut cloud).await;
|
env_cloud("*", &mut cloud.env).await?;
|
||||||
// app_api.to_owned()
|
|
||||||
// If not graphQL comment/remove next line
|
// If not graphQL comment/remove next line
|
||||||
let gql_api=graphql::graphql(gql_path, data_dbs.clone(),cors.clone()).await; //.with(cors.clone());
|
let gql_api=graphql::graphql(gql_path, data_dbs.clone(),cors.clone()).await; //.with(cors.clone());
|
||||||
|
|
||||||
// // Add ALL ENTITIES to work with here
|
// // Add ALL ENTITIES to work with here
|
||||||
let kloud_api = filters::CollFilters::new("kloud")
|
let kloud_api = filters::CollFilters::new(&config.prefix)
|
||||||
.filters_config(data_dbs.clone(),cloud.clone(),cors.clone());
|
.filters_config(data_dbs.clone(),cloud.clone(),cors.clone());
|
||||||
|
|
||||||
let file_api = app_file_filters::files(app_store.clone(),auth_store.clone()).with(cors.clone());
|
let file_api = app_file_filters::files(app_store.clone(),auth_store.clone()).with(cors.clone());
|
||||||
// Path for static files, better to be LAST
|
// Path for static files, better to be LAST
|
||||||
let fs_api = warp::fs::dir(html_path).with(warp::compression::gzip());
|
let fs_api = warp::fs::dir(html_path).with(warp::compression::gzip());
|
||||||
// Recover and handle errors
|
|
||||||
|
let home_api = filters::CollFilters::new(&config.prefix)
|
||||||
|
.filters_home(data_dbs.clone(),cloud.clone(),cors.clone(),"info");
|
||||||
|
|
||||||
let app_api = auth_api
|
let app_api = auth_api
|
||||||
.or(gqli_api).or(gql_api)
|
.or(gqli_api).or(gql_api)
|
||||||
.or(kloud_api)
|
.or(home_api)
|
||||||
.or(file_api)
|
.or(kloud_api)
|
||||||
.or(fs_api)
|
.or(file_api)
|
||||||
.recover(move | error: warp::Rejection| handle_rejection(error, app_store.clone()))
|
.or(fs_api)
|
||||||
.boxed();
|
.recover(move | error: warp::Rejection| handle_rejection(error, app_store.clone()))
|
||||||
|
.boxed();
|
||||||
// Wrap routes with log to get info
|
// Wrap routes with log to get info
|
||||||
let routes = app_api.with(warp::log(log_name));
|
let routes = app_api.with(warp::log(log_name));
|
||||||
//let routes = app_api.with(cors).with(warp::log(log_name));
|
//let routes = app_api.with(cors).with(warp::log(log_name));
|
||||||
@ -426,7 +428,7 @@ pub async fn main() -> BxDynResult<()> { //std::io::Result<()> {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let _= sched.start().await;
|
|
||||||
}
|
}
|
||||||
|
let _= sched.start().await;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user