diff options
| author | Bryan Newbold <bnewbold@archive.org> | 2020-08-25 20:10:46 -0700 | 
|---|---|---|
| committer | Bryan Newbold <bnewbold@archive.org> | 2020-08-25 20:10:46 -0700 | 
| commit | e77a94189ecbf13f041346e7d7b6d3ecf5876a6b (patch) | |
| tree | 1e4f13f88dc735d0cafeb9de0d3cddb63ae44d66 | |
| parent | bdaf45ff85076cec93b68cd45c018bc02e2fa67e (diff) | |
| download | es-public-proxy-e77a94189ecbf13f041346e7d7b6d3ecf5876a6b.tar.gz es-public-proxy-e77a94189ecbf13f041346e7d7b6d3ecf5876a6b.zip | |
rename 'allow_all...' to 'unsafe_all...'
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | extra/example_config.toml | 2 | ||||
| -rw-r--r-- | src/lib.rs | 4 | ||||
| -rw-r--r-- | src/main.rs | 8 | ||||
| -rw-r--r-- | tests/parse_es_requests.rs | 6 | 
5 files changed, 11 insertions, 11 deletions
| @@ -11,7 +11,7 @@ test: ## Run all tests  .PHONY: dev  dev: ## Run service locally (unsafe mode) -	cargo run -- --allow-all-indices +	cargo run -- --unsafe-all-indices  .PHONY: lint  lint: ## Run syntax/style checks diff --git a/extra/example_config.toml b/extra/example_config.toml index cd66403..1baa536 100644 --- a/extra/example_config.toml +++ b/extra/example_config.toml @@ -1,7 +1,7 @@  bind_addr = "127.0.0.1:9292"  upstream_addr = "127.0.0.1:9200" -allow_all_indices = false +unsafe_all_indices = false  # Index-level configuration  [[index]] @@ -10,7 +10,7 @@ use parse::UrlQueryParams;  pub struct ProxyConfig {      pub bind_addr: Option<String>,     // 127.0.0.1:9292      pub upstream_addr: Option<String>, // 127.0.0.1:9200 -    pub allow_all_indices: Option<bool>, +    pub unsafe_all_indices: Option<bool>,      pub index: Vec<IndexConfig>,  } @@ -21,7 +21,7 @@ pub struct IndexConfig {  impl ProxyConfig {      pub fn allow_index(&self, name: &str) -> bool { -        if self.allow_all_indices == Some(true) { +        if self.unsafe_all_indices == Some(true) {              return true;          }          for index in &self.index { diff --git a/src/main.rs b/src/main.rs index d95ef4a..d1c0f02 100644 --- a/src/main.rs +++ b/src/main.rs @@ -66,7 +66,7 @@ fn load_config() -> ProxyConfig {      let args: Vec<String> = env::args().collect();      let args: Vec<&str> = args.iter().map(|x| x.as_str()).collect();      let mut config_path: Option<String> = None; -    let mut allow_all_indices = false; +    let mut unsafe_all_indices = false;      // first parse CLI arg      match args.as_slice() { @@ -80,7 +80,7 @@ fn load_config() -> ProxyConfig {              std::process::exit(0);          }          [_, "--config", p] => config_path = Some(p.to_string()), -        [_, "--allow-all-indices"] => allow_all_indices = true, +        [_, "--unsafe-all-indices"] => unsafe_all_indices = true,          _ => {              eprintln!("{}", usage());              eprintln!("couldn't parse arguments"); @@ -101,8 +101,8 @@ fn load_config() -> ProxyConfig {      } else {          ProxyConfig::default()      }; -    if allow_all_indices { -        config.allow_all_indices = Some(true); +    if unsafe_all_indices { +        config.unsafe_all_indices = Some(true);      }      config  } diff --git a/tests/parse_es_requests.rs b/tests/parse_es_requests.rs index c8081c7..e6f747f 100644 --- a/tests/parse_es_requests.rs +++ b/tests/parse_es_requests.rs @@ -54,7 +54,7 @@ fn parse_scroll_bodies() {  fn filter_search_requests() {      let file_paths = fs::read_dir("tests/files/search").unwrap();      let mut config = ProxyConfig::default(); -    config.allow_all_indices = Some(true); +    config.unsafe_all_indices = Some(true);      let mut rt = tokio::runtime::Runtime::new().unwrap();      for path in file_paths { @@ -72,7 +72,7 @@ fn filter_search_requests() {  fn filter_scroll_requests() {      let file_paths = fs::read_dir("tests/files/scroll").unwrap();      let mut config = ProxyConfig::default(); -    config.allow_all_indices = Some(true); +    config.unsafe_all_indices = Some(true);      let mut rt = tokio::runtime::Runtime::new().unwrap();      for path in file_paths { @@ -90,7 +90,7 @@ fn filter_scroll_requests() {  fn filter_failures() {      let file_paths = fs::read_dir("tests/files/search_fail").unwrap();      let mut config = ProxyConfig::default(); -    config.allow_all_indices = Some(true); +    config.unsafe_all_indices = Some(true);      let mut rt = tokio::runtime::Runtime::new().unwrap();      for path in file_paths { | 
