Skip to content

Commit

Permalink
IDENTITY
Browse files Browse the repository at this point in the history
  • Loading branch information
aniketfuryrocks committed Nov 27, 2023
1 parent a880a53 commit d920203
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions core/src/keypair_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use std::env;

// note this is duplicated from lite-rpc module
pub async fn load_identity_keypair(
identity_from_cli: Option<String>,
identity_path: Option<String>,
) -> anyhow::Result<Option<Keypair>> {
let identity_str = if let Some(identity_from_cli) = identity_from_cli {
let identity_str = if let Some(identity_from_cli) = identity_path {
tokio::fs::read_to_string(identity_from_cli)
.await
.context("Cannot find the identity file provided")?
Expand Down
9 changes: 6 additions & 3 deletions lite-rpc/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub struct Config {
pub lite_rpc_ws_addr: String,
#[serde(default = "Config::default_fanout_size")]
pub fanout_size: u64,
// Identity keypair path
#[serde(default)]
pub identity_keypair: Option<String>,
#[serde(default = "Config::default_prometheus_addr")]
Expand Down Expand Up @@ -93,9 +94,11 @@ impl Config {
.map(|size| size.parse().unwrap())
.unwrap_or(config.fanout_size);

config.identity_keypair = env::var("IDENTITY")
.map(Some)
.unwrap_or(config.identity_keypair);
// IDENTITY env sets value of identity_keypair

// config.identity_keypair = env::var("IDENTITY")
// .map(Some)
// .unwrap_or(config.identity_keypair);

config.prometheus_addr = env::var("PROMETHEUS_ADDR").unwrap_or(config.prometheus_addr);

Expand Down

0 comments on commit d920203

Please sign in to comment.