chore: add filters for apps_services & cleanup
This commit is contained in:
		
							parent
							
								
									943154725a
								
							
						
					
					
						commit
						d4f5bbce45
					
				@ -116,12 +116,14 @@ impl CollFilters {
 | 
			
		||||
    let provision_path: &'static str = Box::leak(format!("{}provision",&self.prfx).into_boxed_str());
 | 
			
		||||
    let status_path: &'static str = Box::leak(format!("{}status",&self.prfx).into_boxed_str());
 | 
			
		||||
    let liveness_path: &'static str = Box::leak(format!("{}liveness",&self.prfx).into_boxed_str());
 | 
			
		||||
    let apps_path: &'static str = Box::leak(format!("{}apps",&self.prfx).into_boxed_str());
 | 
			
		||||
		self.config(db.clone(),cloud.clone(),config_path,cors.clone())
 | 
			
		||||
			.or(self.defs(db.clone(),defs_path,cors.clone()))
 | 
			
		||||
			.or(self.langs(db.clone(),lang_path,cors.clone()))
 | 
			
		||||
			.or(self.provision(db.clone(),cloud.clone(),provision_path,cors.clone()))
 | 
			
		||||
			.or(self.status(db.clone(),cloud.clone(),status_path,cors.clone()))
 | 
			
		||||
			.or(self.liveness(db.clone(),cloud.clone(),liveness_path,cors.clone()))
 | 
			
		||||
			.or(self.apps(db.clone(),cloud.clone(),apps_path,cors.clone()))
 | 
			
		||||
			.boxed()
 | 
			
		||||
  }
 | 
			
		||||
  /// GET /ta?offset=3&limit=5
 | 
			
		||||
@ -399,6 +401,31 @@ impl CollFilters {
 | 
			
		||||
			.and_then(handlers::h_config::liveness)
 | 
			
		||||
			.with(cors)
 | 
			
		||||
			.boxed()
 | 
			
		||||
  }
 | 
			
		||||
	/// GET /status?offset=3&limit=5
 | 
			
		||||
  pub fn apps(
 | 
			
		||||
    &self,
 | 
			
		||||
    db: DataDBs,
 | 
			
		||||
		cloud: Cloud,
 | 
			
		||||
    path: &'static str, 
 | 
			
		||||
    cors: warp::cors::Builder,
 | 
			
		||||
  //) -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejection> + Clone {
 | 
			
		||||
  ) -> BoxedFilter<(impl warp::Reply,)> {
 | 
			
		||||
    let prfx = self.prfx.to_owned();
 | 
			
		||||
    warp::path(path)
 | 
			
		||||
			.and(warp::get())
 | 
			
		||||
			.and(warp::query::<KloudQueryConfigFilters>())
 | 
			
		||||
			.and(headers_cloned())
 | 
			
		||||
			.and(method())
 | 
			
		||||
			// .and_then(user_authentication)
 | 
			
		||||
			// .and(warp::header::optional::<String>("authorization"))
 | 
			
		||||
			// .and(warp::header::optional::<String>("accept-language"))
 | 
			
		||||
			.and(self.with_db(db))
 | 
			
		||||
			.and(warp::any().map(move || cloud.to_owned()))
 | 
			
		||||
			.and(warp::any().map(move || prfx.to_owned()))
 | 
			
		||||
			.and_then(handlers::h_config::apps)
 | 
			
		||||
			.with(cors)
 | 
			
		||||
			.boxed()
 | 
			
		||||
  }
 | 
			
		||||
  fn with_db(&self, db: DataDBs) -> impl Filter<Extract = (DataDBs,), Error = std::convert::Infallible> + Clone {
 | 
			
		||||
    warp::any().map(move || db.clone())
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user