4.6.2 • Published 2 years ago

@artcom/bootstrap-client v4.6.2

Weekly downloads
32
License
MIT
Repository
github
Last release
2 years ago

Bootstrap Client

Queries bootstrap data from the bootstrap server and initializes an MQTT client and a logger for services.

Usage

Install this library via npm:

npm install @artcom/bootstrap-client

Bootstrap as follows:

const bootstrap = require("@artcom/bootstrap-client")

bootstrap(bootstrapUrl, serviceId).then(async ({ logger, mqttClient, queryConfig, data }) => {
  // log something
  logger.info("Hello world!")

  // publish "bar" to topic "foo"
  mqttClient.publish("foo", "bar")

  // query some configurations with (optional) options
  const myConfig = await queryConfig("config/path", { version: "master", listFiles: false, includeCommitHash = false, parseJSON = true })

  // use raw bootstrap data
  logger.info(`I am running on device: ${data.device}`)
})

The following additional options are supported:

  • timeout: is the time in milliseconds until the query times out, default: 2000
  • retryDelay: is the time in milliseconds until the query is sent again, default: 10000
  • debugBootstrapData: can be set to skip querying data from the bootstrap server for debugging, default: null

Bootstrap Data

The client expects the following properties in the bootstrap server response or debugBootstrapData:

{
  tcpBrokerUri: string,
  httpBrokerUri: string,
  configServerUri: string,
  device: string
}

Checkout the bootstrap server documentation for details.

4.6.2

2 years ago

4.6.1

2 years ago

4.5.0

2 years ago

4.4.1

2 years ago

4.3.2

2 years ago

4.4.0

2 years ago

4.3.4

2 years ago

4.6.0

2 years ago

4.5.1

2 years ago

4.3.3

2 years ago

4.3.0

3 years ago

4.2.2

3 years ago

4.2.1

3 years ago

4.2.0

3 years ago

4.1.0

4 years ago

4.0.2

4 years ago

4.0.1

4 years ago

4.0.0

4 years ago

3.0.0

4 years ago

2.5.0

4 years ago

2.4.0

4 years ago

2.3.1

4 years ago

2.3.0

4 years ago

2.2.2

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.2

4 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago