Skip to content

Commit

Permalink
WAYK-2566: Remove unrestricted config parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
fdubois1 committed Aug 3, 2021
1 parent fe03b14 commit 17e8bae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ FLAGS:
--service
Enable service mode
--unrestricted
Remove API key validation on some HTTP routes
-v, --version
Prints version information
Expand Down
22 changes: 2 additions & 20 deletions devolutions-gateway/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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<String>,
pub listeners: Vec<ListenerConfig>,
pub farm_name: String,
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -286,8 +283,6 @@ pub struct ConfigFile {
pub log_file: Option<String>,
#[serde(rename = "CapturePath")]
pub capture_path: Option<String>,
#[serde(rename = "Unrestricted")]
pub unrestricted: Option<bool>,
}

fn get_config_path() -> PathBuf {
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 17e8bae

Please sign in to comment.