Skip to content

Commit

Permalink
Merge pull request #101 from cabal-club/preferredPort
Browse files Browse the repository at this point in the history
add preferredPort (default 13331) to core opts
  • Loading branch information
cblgh authored Jan 12, 2021
2 parents 2f41eb5 + 77a15b9 commit b897e0e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var cabal = Cabal(storage, key, { db: level('/tmp/bot.db') })

Other `opts` include:

- `opts.preferredPort`: controls the port cabal listens on. defaults to port `13331`.
- `opts.modKeys`: an array of keys to be considered moderators from this user's perspective.
- `opts.adminKeys`: an array of keys to be considered administrators from this user's perspective.

Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function Cabal (storage, key, opts) {
this.maxFeeds = opts.maxFeeds
this.modKeys = opts.modKeys || []
this.adminKeys = opts.adminKeys || []
this.preferredPort = opts.preferredPort || 13331

if (!key) this.key = generateKeyHex()
else {
Expand Down
3 changes: 2 additions & 1 deletion swarm.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ module.exports = function (cabal, opts, cb) {

const discoveryKey = crypto.discoveryKey(Buffer.from(cabal.key, 'hex'))

const swarm = hyperswarm()
const { preferredPort } = cabal
const swarm = hyperswarm({ preferredPort })
swarm.join(discoveryKey, {
lookup: true,
announce: true
Expand Down

0 comments on commit b897e0e

Please sign in to comment.