From 17e8baec43981beb4c8c69a1bb866ca6227ba049 Mon Sep 17 00:00:00 2001 From: Francois Dubois Date: Tue, 3 Aug 2021 10:18:10 -0400 Subject: [PATCH] WAYK-2566: Remove unrestricted config parameter --- README.md | 3 --- devolutions-gateway/src/config.rs | 22 ++-------------------- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 44a988158..a1679a96e 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,6 @@ FLAGS: --service Enable service mode - --unrestricted - Remove API key validation on some HTTP routes - -v, --version Prints version information diff --git a/devolutions-gateway/src/config.rs b/devolutions-gateway/src/config.rs index ef1db2d2f..47b18270b 100644 --- a/devolutions-gateway/src/config.rs +++ b/devolutions-gateway/src/config.rs @@ -13,7 +13,6 @@ use url::Url; const ARG_API_KEY: &str = "api-key"; const ARG_APPLICATION_PROTOCOLS: &str = "application-protocols"; -const ARG_UNRESTRICTED: &str = "unrestricted"; const ARG_LISTENERS: &str = "listeners"; const ARG_HOSTNAME: &str = "hostname"; const ARG_FARM_NAME: &str = "farm-name"; @@ -118,7 +117,6 @@ pub struct Config { pub display_name: String, pub description: String, pub company_name: String, - pub unrestricted: bool, pub api_key: Option, pub listeners: Vec, pub farm_name: String, @@ -147,7 +145,6 @@ impl Default for Config { display_name: DISPLAY_NAME.to_string(), description: DESCRIPTION.to_string(), company_name: COMPANY_NAME.to_string(), - unrestricted: true, // TODO: Should be false by default in a future version api_key: None, listeners: Vec::new(), farm_name: default_hostname.clone(), @@ -286,8 +283,6 @@ pub struct ConfigFile { pub log_file: Option, #[serde(rename = "CapturePath")] pub capture_path: Option, - #[serde(rename = "Unrestricted")] - pub unrestricted: Option, } fn get_config_path() -> PathBuf { @@ -363,13 +358,6 @@ impl Config { .takes_value(true) .empty_values(false), ) - .arg( - Arg::with_name(ARG_UNRESTRICTED) - .long("unrestricted") - .env("DGATEWAY_UNRESTRICTED") - .help("Remove API key validation on some HTTP routes") - .takes_value(false), - ) .arg( Arg::with_name(ARG_LISTENERS) .short("l") @@ -644,10 +632,6 @@ impl Config { config.api_key = Some(api_key.to_owned()); } - if matches.is_present(ARG_UNRESTRICTED) { - config.unrestricted = true; - } - if let Some(farm_name) = matches.value_of(ARG_FARM_NAME) { config.farm_name = farm_name.to_owned(); } @@ -848,8 +832,8 @@ impl Config { } // early fail if we start as restricted without provisioner key - if !config.unrestricted && config.provisioner_public_key.is_none() { - panic!("provisioner public key is missing in unrestricted mode"); + if config.provisioner_public_key.is_none() { + panic!("provisioner public key is missing"); } if let Some(recording_path) = matches.value_of(ARG_RECORDING_PATH) { @@ -963,11 +947,9 @@ impl Config { // unstable options (subject to change) let api_key = config_file.api_key; - let unrestricted = config_file.unrestricted.unwrap_or(true); let capture_path = config_file.capture_path; Some(Config { - unrestricted, api_key, listeners, farm_name,