-
Notifications
You must be signed in to change notification settings - Fork 4
feat: cli supports peer id path #26
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Side note:
I just realized we are using camelcase options here and in webrtc star. It would probably be preferable to conform to more standard options, ie --peer-id
, --disable-metrics
, etc.
const peerData = fs.readFileSync(argv.peerId) | ||
const peerId = await PeerId.createFromJSON(JSON.parse(peerData)) | ||
peerInfo = await PeerInfo.create(peerId) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, maybe we should add a log here when the peer id is not provided, just to warn that a new id will be created at each restart, and recommend using the peer id option.
803b210
to
d298ee9
Compare
@jacobheun regarding the options I agree with you! The easiest solution is to define alias in |
Any reason to support both? We haven't released yet and it's already a breaking change. webrtc-star could have both supported there since it's released. |
I would support both to be consistent with |
Co-Authored-By: Jacob Heun <[email protected]>
ah, okay that's fine |
For having easy and automatic deploys while keeping the same address in the server, this PR adds support to provide a path for a
peer-id
JSON file.It can be tested as follows:
> node src/server/bin.js --peerId test/fixtures/peer-server.json