Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ Based on this configuration:
- The API key will be set to `xxxxx` (this is optional)
- There is one peer named `org-b` whose P2P endpoint is `https://localhost:4001`

Note: the property `p2p.endpoint` can optionally be used to specify a front facing endpoint.
If this property is not provided, the p2p endpoint will be calculated as `p2p.hostname`:`p2p.port`

#### Generate certificate

In the data directory, run the following command:
Expand Down Expand Up @@ -93,6 +96,8 @@ Based on this configuration:
- The API key will be set to `xxxxx` (this is optional)
- There is one peer named `org-a` whose P2P endpoint is `https://localhost:3001`

Note: the property `p2p.endpoint` can optionally be used to specify a front facing endpoint.
If this property is not provided, the p2p endpoint will be calculated as `p2p.hostname`:`p2p.port`

#### Generate certificate

Expand Down
1 change: 1 addition & 0 deletions src/lib/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface IConfig {
p2p: {
hostname: string
port: number
endpoint?: string
}
apiKey?: string
peers: {
Expand Down
2 changes: 1 addition & 1 deletion src/routers/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ router.get('/id', async (_req, res, next) => {
try {
res.send({
id: peerID,
endpoint: `https://${config.p2p.hostname}:${config.p2p.port}`,
endpoint: config.p2p.endpoint ?? `https://${config.p2p.hostname}:${config.p2p.port}`,
cert
});
} catch (err) {
Expand Down
3 changes: 3 additions & 0 deletions src/schemas/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
},
"port": {
"type": "integer"
},
"endpoint": {
"type": "string"
}
}
},
Expand Down