Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

Commit

Permalink
remove unused proxy control endpoints
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Scholtes <[email protected]>
  • Loading branch information
geigerzaehler committed Jun 2, 2022
1 parent 4e56c16 commit e9b7710
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 66 deletions.
10 changes: 0 additions & 10 deletions upstream-proxy/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ pub enum Context {
}

impl Context {
/// Returns `true` if the stack is set up in test mode.
pub const fn test(&self) -> bool {
match self {
Self::Sealed(sealed) => sealed.test,
Self::Unsealed(unsealed) => unsealed.rest.test,
}
}

/// Returns a handle to control the service configuration
pub fn service_handle(&mut self) -> &mut service::Handle {
match self {
Expand Down Expand Up @@ -111,8 +103,6 @@ pub struct Unsealed {
pub struct Sealed {
/// [`kv::Store`] used for session state and cache.
pub store: kv::Store,
/// Flag to control if the stack is set up in test mode.
pub test: bool,
/// Handle to control the service configuration.
pub service_handle: service::Handle,
/// Reference to the key store.
Expand Down
23 changes: 2 additions & 21 deletions upstream-proxy/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
//! HTTP API delivering JSON over `RESTish` endpoints.
use serde::Deserialize;
use warp::{filters::BoxedFilter, path, reject, Filter, Rejection, Reply};
use warp::{filters::BoxedFilter, path, Filter, Rejection, Reply};

use link_crypto::PeerId;

use crate::context;

mod control;
pub mod error;
mod notification;
mod project;
Expand All @@ -40,29 +39,11 @@ macro_rules! combine {
pub fn api(
ctx: context::Context,
) -> impl Filter<Extract = impl Reply, Error = std::convert::Infallible> + Clone {
let test = ctx.test();

let control_filter = path("control")
.map(move || test)
.and_then(|enable| async move {
if enable {
Ok(())
} else {
Err(reject::not_found())
}
})
.untuple_one()
.and(control::filters(ctx.clone()));
let notification_filter = path("notifications").and(notification::filters(ctx.clone()));
let project_filter = path("projects").and(project::filters(ctx.clone()));
let source_filter = path("source").and(source::filters(ctx));

let api = path("v1").and(combine!(
control_filter,
notification_filter,
project_filter,
source_filter
));
let api = path("v1").and(combine!(notification_filter, project_filter, source_filter));

api.recover(error::recover)
}
Expand Down
34 changes: 0 additions & 34 deletions upstream-proxy/src/http/control.rs

This file was deleted.

1 change: 0 additions & 1 deletion upstream-proxy/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ async fn run_session(

let sealed = context::Sealed {
store: store.clone(),
test: environment.test_mode,
service_handle,
keystore: environment.keystore.clone(),
paths: paths.clone(),
Expand Down

0 comments on commit e9b7710

Please sign in to comment.