chore: home filter

This commit is contained in:
Jesús Pérez Lorenzo 2021-10-12 11:12:26 +01:00
parent 836ab03ccf
commit 80810d30a6
2 changed files with 18 additions and 15 deletions

View File

@ -1,4 +1,5 @@
pub mod h_config;
pub mod h_data;
pub mod h_defs;
pub mod h_home;
pub mod datastores;

View File

@ -24,7 +24,7 @@ use crate::defs::{DataDBs,CollsData,load_cloud_env};
use clds::clouds::defs::{
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;
// static WEBSERVER: AtomicUsize = AtomicUsize::new(0);
@ -136,26 +136,28 @@ async fn up_web_server(webpos: usize) -> Result<()> {
);
}
let mut cloud = Cloud::default();
load_cloud_env(&mut cloud).await;
// app_api.to_owned()
env_cloud("*", &mut cloud.env).await?;
// If not graphQL comment/remove next line
let gql_api=graphql::graphql(gql_path, data_dbs.clone(),cors.clone()).await; //.with(cors.clone());
// // 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());
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
let fs_api = warp::fs::dir(html_path).with(warp::compression::gzip());
// Recover and handle errors
let fs_api = warp::fs::dir(html_path).with(warp::compression::gzip());
let home_api = filters::CollFilters::new(&config.prefix)
.filters_home(data_dbs.clone(),cloud.clone(),cors.clone(),"info");
let app_api = auth_api
.or(gqli_api).or(gql_api)
.or(kloud_api)
.or(file_api)
.or(fs_api)
.recover(move | error: warp::Rejection| handle_rejection(error, app_store.clone()))
.boxed();
.or(gqli_api).or(gql_api)
.or(home_api)
.or(kloud_api)
.or(file_api)
.or(fs_api)
.recover(move | error: warp::Rejection| handle_rejection(error, app_store.clone()))
.boxed();
// Wrap routes with log to get info
let routes = app_api.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(())
}