Skip to content

Commit

Permalink
feat: Allow to control port range for cote
Browse files Browse the repository at this point in the history
closes #29
  • Loading branch information
claustres committed Sep 2, 2019
1 parent cd79922 commit 4161e3b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { stripSlashes } from '@feathersjs/commons'
import makeCote from 'cote'
import uuid from 'uuid/v4'
import makeDebug from 'debug'
import portfinder from 'portfinder'
import { LocalService, RemoteService } from './service'

const debug = makeDebug('feathers-distributed')
Expand Down Expand Up @@ -30,6 +31,8 @@ export default function init (options) {
let app = this
// Because options are forwarded and assigned to defaults options of services allocate an empty object if nothing is provided
app.coteOptions = distributionOptions.cote || {}
// Change default base port for automated port finding
portfinder.basePort = app.coteOptions.basePort || 10000
app.cote = (distributionOptions.cote ? makeCote(distributionOptions.cote) : makeCote())
// We need to uniquely identify the app to avoid infinite loop by registering our own services
app.uuid = uuid()
Expand Down

0 comments on commit 4161e3b

Please sign in to comment.