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

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
  • Loading branch information
rudolfs committed Nov 15, 2021
1 parent 0458248 commit d9c6fc9
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 15 deletions.
4 changes: 0 additions & 4 deletions proxy/api/Cargo.toml
Expand Up @@ -16,10 +16,6 @@ default-run = "radicle-proxy"
# of the key stored on disk.
unsafe-fast-keystore = []

# Enables the option to use the HTTP API insecurely without checking for the
# session token to make testing easier.
insecure-http-api = []

[dependencies]
anyhow = "1.0"
async-stream = "0.3"
Expand Down
1 change: 0 additions & 1 deletion proxy/api/src/cli.rs
Expand Up @@ -46,7 +46,6 @@ pub struct Args {
pub unsafe_fast_keystore: bool,

/// If `true`, the HTTP api will accept any request without checking the auth token.
#[cfg(feature = "insecure-http-api")]
#[structopt(long)]
pub insecure_http_api: bool,

Expand Down
3 changes: 1 addition & 2 deletions proxy/api/src/process.rs
Expand Up @@ -31,10 +31,9 @@ pub async fn run(args: Args) -> Result<(), anyhow::Error> {

let mut service_manager = service::Manager::new(service::EnvironmentConfig {
test_mode: args.test,
insecure_http_api: args.insecure_http_api,
#[cfg(feature = "unsafe-fast-keystore")]
unsafe_fast_keystore: args.unsafe_fast_keystore,
#[cfg(feature = "insecure-http-api")]
insecure_http_api: args.insecure_http_api,
})?;

if let Some(passphrase) = &args.key_passphrase {
Expand Down
9 changes: 1 addition & 8 deletions proxy/api/src/service.rs
Expand Up @@ -43,7 +43,6 @@ pub struct EnvironmentConfig {
pub unsafe_fast_keystore: bool,

/// If `true`, the HTTP api will accept any request without checking the auth token.
#[cfg(feature = "insecure-http-api")]
pub insecure_http_api: bool,
}

Expand Down Expand Up @@ -83,19 +82,13 @@ impl Environment {
Arc::new(keystore::file(coco_profile.paths().clone()))
};

#[cfg(not(feature = "insecure-http-api"))]
let insecure_http_api = false;

#[cfg(feature = "insecure-http-api")]
let insecure_http_api = config.insecure_http_api;

Ok(Self {
key: None,
temp_dir,
coco_profile,
keystore,
test_mode: config.test_mode,
insecure_http_api,
insecure_http_api: config.insecure_http_api,
})
}
}
Expand Down

0 comments on commit d9c6fc9

Please sign in to comment.