Skip to content

Commit

Permalink
feat(getinfo) : adds alias inside lampo.conf
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshit933 committed Apr 4, 2024
1 parent 5bc56d7 commit a8cad28
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lampo-common/src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub struct LampoConf {
pub channels_keys: Option<String>,
pub log_file: Option<String>,
pub log_level: String,
pub alias: String,
}

impl LampoConf {
Expand Down Expand Up @@ -48,6 +49,7 @@ impl LampoConf {
channels_keys: None,
log_level: "info".to_string(),
log_file: None,
alias: "".to_string(),
}
}

Expand Down Expand Up @@ -213,6 +215,9 @@ impl TryFrom<String> for LampoConf {
_ => "info".to_string(),
};
let log_file = conf.get_conf("log-file").unwrap_or_else(|_| None);
let alias_file = conf.get_conf("alias").unwrap_or(None);
let alias = alias_file.unwrap_or_else(|| "".to_string());

Ok(Self {
inner: Some(conf),
root_path,
Expand All @@ -227,6 +232,7 @@ impl TryFrom<String> for LampoConf {
channels_keys,
log_file,
log_level: level,
alias,
})
}
}
Expand Down
1 change: 1 addition & 0 deletions lampo-common/src/model/getinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ pub struct GetInfo {
pub peers: usize,
pub channels: usize,
pub chain: String,
pub alias: String,
}
1 change: 1 addition & 0 deletions lampod/src/ln/inventory_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ impl InventoryHandler for LampoInventoryManager {
peers: self.peer_manager.manager().list_peers().len(),
channels: self.channel_manager.manager().list_channels().len(),
chain,
alias: self.channel_manager.conf.alias.to_string()
};
let getinfo = json::to_value(getinfo)?;
chan.send(getinfo)?;
Expand Down

0 comments on commit a8cad28

Please sign in to comment.