Socket
Book a DemoInstallSign in
Socket

@bitfinex/bfx-facs-base

Package Overview
Dependencies
Maintainers
4
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bitfinex/bfx-facs-base

Bitfinex base facility

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
4
Created
Source

bfx-facs-base

bootstrap hooks

Some facilities need special setup before other facilites are started. By default, the bfx-facs-grc, which announces the service to the Grape network is started later than the other facs.

To run special setup or cleanup tasks before other facs start, use the start option:

const opts = {
  start: (inst, cb) => {
    console.log(inst.db) // do async stuff here
    cb(null)
  }
}
this.setInitFacs([
  ['fac', 'bfx-facs-db-mongo', 'm0', 'm0', opts]
])

Example:

On service start, this will print:

bfx-facs-first start hook
bfx-facs-second start hook
start0 executed
class WrkUtilNetApi extends WrkApi {
  init () {
    super.init()

    this.setInitFacs([
      ['fac', 'bfx-facs-first', 'm0', 'm0', {
        start: (inst, cb) => {
          console.log('bfx-facs-first start hook')
          cb(null)
        }
      }, 0], // prio: 0 (default)
      ['fac', 'bfx-facs-second', 'm0', 'm0', {
        start: (inst, cb) => {
          console.log('bfx-facs-second start hook')
          cb(null)
        }
      }, 1], // prio 1
    ])
  }

  _start0 (cb) {
    console.log('start0 executed')
    cb(null)
  }
}

Keywords

bitfinex

FAQs

Package last updated on 08 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts