This package has been deprecated

Author message:

resin-device-config is deprecated, please use balena-device-config instead

resin-device-config

5.1.1 • Public • Published

resin-device-config

npm version dependencies Build Status Build status

Join our online chat at Gitter chat

Get device config.json configuration.

Role

The intention of this module is to provide low level access to how a Resin.io device config.json file is generated.

THIS MODULE IS LOW LEVEL AND IS NOT MEANT TO BE USED BY END USERS DIRECTLY.

Installation

Install resin-device-config by running:

$ npm install --save resin-device-config

Documentation

deviceConfig.generate(options, params) ⇒ Object

Kind: static method of deviceConfig
Summary: Generate a basic config.json object
Returns: Object - config.json
Access: public

Param Type Description
options Object options
params Object user params

Example

config = deviceConfig.generate
    application:
        app_name: 'HelloWorldApp'
        id: 18
        device_type: 'raspberry-pi'
    user:
        id: 7
        username: 'johndoe'
    mixpanel:
        token: 'e3bc4100330c35722740fb8c6f5abddc'
    apiKey: 'asdf'
    vpnPort: 443
    endpoints:
        api: 'https://api.resin.io'
        vpn: 'vpn.resin.io'
        registry: 'registry.resin.io'
,
    network: 'ethernet'
    appUpdatePollInterval: 50000
 
console.log(config)

Example

config = deviceConfig.generate
    application:
        app_name: 'HelloWorldApp'
        id: 18
        device_type: 'raspberry-pi2'
    deviceType: 'raspberrypi3'
    user:
        id: 7
        username: 'johndoe'
    mixpanel:
        token: 'e3bc4100330c35722740fb8c6f5abddc'
    apiKey: 'asdf'
    vpnPort: 443
    endpoints:
        api: 'https://api.resin.io'
        vpn: 'vpn.resin.io'
        registry: 'registry.resin.io'
,
    network: 'ethernet'
    appUpdatePollInterval: 50000
 
console.log(config)

deviceConfig.validate(config)

Kind: static method of deviceConfig
Summary: Validate a generated config.json object
Throws:

  • Will throw if there is a validation error

Access: public

Param Type Description
config Object generated config object

Example

config = deviceConfig.generate
    application:
        app_name: 'HelloWorldApp'
        id: 18
        device_type: 'raspberry-pi'
    user:
        id: 7
        username: 'johndoe'
    mixpanel:
        token: 'e3bc4100330c35722740fb8c6f5abddc'
    apiKey: 'asdf'
    vpnPort: 443
    endpoints:
        api: 'https://api.resin.io'
        vpn: 'vpn.resin.io'
        registry: 'registry.resin.io'
,
    network: 'ethernet'
    appUpdatePollInterval: 50000
 
deviceConfig.validate(config)

Support

If you're having any problem, please raise an issue on GitHub and the Resin.io team will be happy to help.

Tests

Run the test suite by doing:

$ gulp test

Contribute

Before submitting a PR, please make sure that you include tests, and that coffeelint runs without any warning:

$ gulp lint

License

The project is licensed under the Apache 2.0 license.

Package Sidebar

Install

npm i resin-device-config

Weekly Downloads

2

Version

5.1.1

License

Apache-2.0

Unpacked Size

37.2 kB

Total Files

13

Last publish

Collaborators

  • balena.io