Sitelet https://github.com/nullmastermind/graph-node/commit/1404b2ed74312489d62e3c47cd053be0fcc59ce6
Skip to content

Commit 1404b2e

Browse files
committed
node: Store the node name in Config
1 parent 3a3ca30 commit 1404b2e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎node/src/config.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ impl Default for Opt {
6464

6565
#[derive(Clone, Debug, Deserialize, Serialize)]
6666
pub struct Config {
67+
#[serde(skip, default = "default_node_id")]
68+
pub node: NodeId,
6769
pub general: Option<GeneralSection>,
6870
#[serde(rename = "store")]
6971
pub stores: BTreeMap<String, Shard>,
@@ -173,8 +175,11 @@ impl Config {
173175
let deployment = Deployment::from_opt(opt);
174176
let mut stores = BTreeMap::new();
175177
let chains = ChainSection::from_opt(opt)?;
178+
let node = NodeId::new(opt.node_id.to_string())
179+
.map_err(|()| anyhow!("invalid node id {}", opt.node_id))?;
176180
stores.insert(PRIMARY_SHARD.to_string(), Shard::from_opt(true, opt)?);
177181
Ok(Config {
182+
node,
178183
general: None,
179184
stores,
180185
chains,

0 commit comments

Comments
 (0)