Skip to content

Commit

Permalink
fix(standalone): hide etcd pwd in logs (#13034)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwannoel authored Oct 26, 2023
1 parent b0f266b commit de8d217
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/cmd_all/src/standalone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,15 @@ mod test {
// Test parsing into standalone-level opts.
let raw_opts = "
--compute-opts=--listen-addr 127.0.0.1:8000 --total-memory-bytes 34359738368 --parallelism 10
--meta-opts=--advertise-addr 127.0.0.1:9999 --data-directory \"some path with spaces\" --listen-addr 127.0.0.1:8001
--meta-opts=--advertise-addr 127.0.0.1:9999 --data-directory \"some path with spaces\" --listen-addr 127.0.0.1:8001 --etcd-password 1234
--frontend-opts=--config-path=src/config/original.toml
--prometheus-listener-addr=127.0.0.1:1234
--config-path=src/config/test.toml
";
let actual = StandaloneOpts::parse_from(raw_opts.lines());
let opts = StandaloneOpts {
compute_opts: Some("--listen-addr 127.0.0.1:8000 --total-memory-bytes 34359738368 --parallelism 10".into()),
meta_opts: Some("--advertise-addr 127.0.0.1:9999 --data-directory \"some path with spaces\" --listen-addr 127.0.0.1:8001".into()),
meta_opts: Some("--advertise-addr 127.0.0.1:9999 --data-directory \"some path with spaces\" --listen-addr 127.0.0.1:8001 --etcd-password 1234".into()),
frontend_opts: Some("--config-path=src/config/original.toml".into()),
compactor_opts: None,
prometheus_listener_addr: Some("127.0.0.1:1234".into()),
Expand All @@ -228,7 +228,7 @@ mod test {
etcd_endpoints: "",
etcd_auth: false,
etcd_username: "",
etcd_password: "",
etcd_password: [REDACTED alloc::string::String],
sql_endpoint: None,
dashboard_ui_path: None,
prometheus_endpoint: None,
Expand Down
1 change: 1 addition & 0 deletions src/meta/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ etcd-client = { workspace = true }
futures = { version = "0.3", default-features = false, features = ["alloc"] }
itertools = "0.11"
prometheus-http-query = "0.7"
redact = "0.1.5"
regex = "1"
risingwave_common = { workspace = true }
risingwave_common_heap_profiling = { workspace = true }
Expand Down
9 changes: 7 additions & 2 deletions src/meta/node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
#![cfg_attr(coverage, feature(coverage_attribute))]

mod server;

use std::time::Duration;

use clap::Parser;
pub use error::{MetaError, MetaResult};
use redact::Secret;
use risingwave_common::config::OverrideConfig;
use risingwave_common::util::resource_util;
use risingwave_common::{GIT_SHA, RW_VERSION};
Expand Down Expand Up @@ -71,7 +73,7 @@ pub struct MetaNodeOpts {

/// Password of etcd, required when --etcd-auth is enabled.
#[clap(long, env = "RW_ETCD_PASSWORD", default_value = "")]
etcd_password: String,
etcd_password: Secret<String>,

/// Endpoint of the SQL service, make it non-option when SQL service is required.
#[clap(long, env = "RW_SQL_ENDPOINT")]
Expand Down Expand Up @@ -196,7 +198,10 @@ pub fn start(opts: MetaNodeOpts) -> Pin<Box<dyn Future<Output = ()> + Send>> {
.map(|x| x.to_string())
.collect(),
credentials: match opts.etcd_auth {
true => Some((opts.etcd_username, opts.etcd_password)),
true => Some((
opts.etcd_username,
opts.etcd_password.expose_secret().to_string(),
)),
false => None,
},
},
Expand Down

0 comments on commit de8d217

Please sign in to comment.