Skip to content

Commit

Permalink
Seed nodes: provided seed nodes should override defaults if overlapping
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuakarp authored and CMCDragonkai committed Mar 26, 2022
1 parent 6e2e39f commit 343c887
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/bin/agent/CommandStart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,14 @@ class CommandStart extends CommandPolykey {
options.recoveryCodeFile,
this.fs,
);
// Will be `[{}, true]` if `--seed-nodes` is not set
// Will be '[{}, true]' if `--seed-nodes='<defaults>'`
// Will be '[{...}, true]' if `--seed-nodes='...;<defaults>'`
// Will be '[{}, false]' if `--seed-nodes=''`
// Will be '[{...}, false]' if `--seed-nodes='...'`
const [seedNodes, defaults] = options.seedNodes;
if (defaults) Object.assign(seedNodes, options.network);
let seedNodes_ = seedNodes;
if (defaults) seedNodes_ = {...options.network, ...seedNodes};
const agentConfig = {
password,
nodePath: options.nodePath,
Expand All @@ -92,7 +98,7 @@ class CommandStart extends CommandPolykey {
proxyHost: options.proxyHost,
proxyPort: options.proxyPort,
},
seedNodes,
seedNodes: seedNodes_,
fresh: options.fresh,
};
let recoveryCodeOut: RecoveryCode | undefined;
Expand Down

0 comments on commit 343c887

Please sign in to comment.