Skip to content

Commit

Permalink
feat: support initializing license key from env var (#17906)
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <[email protected]>
  • Loading branch information
BugenZhao authored Aug 12, 2024
1 parent 5137f48 commit fbb30ad
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/cmd_all/src/standalone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ mod test {
heap_profiling_dir: None,
dangerous_max_idle_secs: None,
connector_rpc_endpoint: None,
license_key: None,
temp_secret_file_dir: "./meta/secrets/",
},
),
Expand Down
8 changes: 7 additions & 1 deletion src/meta/node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use educe::Educe;
pub use error::{MetaError, MetaResult};
use redact::Secret;
use risingwave_common::config::OverrideConfig;
use risingwave_common::license::LicenseKey;
use risingwave_common::util::meta_addr::MetaAddressStrategy;
use risingwave_common::util::resource_util;
use risingwave_common::util::tokio_util::sync::CancellationToken;
Expand Down Expand Up @@ -187,8 +188,13 @@ pub struct MetaNodeOpts {
#[clap(long, hide = true, env = "RW_CONNECTOR_RPC_ENDPOINT")]
pub connector_rpc_endpoint: Option<String>,

/// The license key to activate enterprise features.
#[clap(long, hide = true, env = "RW_LICENSE_KEY")]
#[override_opts(path = system.license_key)]
pub license_key: Option<LicenseKey>,

/// 128-bit AES key for secret store in HEX format.
#[educe(Debug(ignore))]
#[educe(Debug(ignore))] // TODO: use newtype to redact debug impl
#[clap(long, hide = true, env = "RW_SECRET_STORE_PRIVATE_KEY_HEX")]
pub secret_store_private_key_hex: Option<String>,

Expand Down
3 changes: 1 addition & 2 deletions src/meta/src/controller/system_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ use sea_orm::{ActiveModelTrait, DatabaseConnection, EntityTrait, TransactionTrai
use tokio::sync::oneshot::Sender;
use tokio::sync::RwLock;
use tokio::task::JoinHandle;
use tracing::info;

use crate::controller::SqlMetaStore;
use crate::manager::{LocalNotification, NotificationManagerRef};
Expand Down Expand Up @@ -143,7 +142,7 @@ impl SystemParamsController {
let params = SystemParameter::find().all(&db).await?;
let params = merge_params(system_params_from_db(params)?, init_params);

info!(initial_params = ?SystemParamsReader::new(&params), "initialize system parameters");
tracing::info!(initial_params = ?SystemParamsReader::new(&params), "initialize system parameters");
check_missing_params(&params).map_err(|e| anyhow!(e))?;

let ctl = Self {
Expand Down
3 changes: 1 addition & 2 deletions src/meta/src/manager/system_param/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ use risingwave_pb::meta::SystemParams;
use tokio::sync::oneshot::Sender;
use tokio::sync::RwLock;
use tokio::task::JoinHandle;
use tracing::info;

use self::model::SystemParamsModel;
use super::NotificationManagerRef;
Expand Down Expand Up @@ -77,7 +76,7 @@ impl SystemParamsManager {
return Err(require_sql_meta_store_err().into());
}

info!(initial_params = ?SystemParamsReader::new(&params), "initialize system parameters");
tracing::info!(initial_params = ?SystemParamsReader::new(&params), "initialize system parameters");
check_missing_params(&params).map_err(|e| anyhow!(e))?;

Ok(Self {
Expand Down

0 comments on commit fbb30ad

Please sign in to comment.