Balena client application shared settings
npm install balena-settings-clientbalena-settings-client
---------------------




Join our online chat at 
Balena client application shared settings.
Role
----
The intention of this module is to provice low level access to user configurable balena simple settings.
THIS MODULE IS LOW LEVEL AND IS NOT MEANT TO BE USED BY END USERS DIRECTLY.
Unless you know what you're doing, use the balena SDK instead.
Installation
------------
Install balena-settings-client by running:
``sh`
$ npm install --save balena-settings-client
Documentation
-------------
This module attempts to retrieve configuration from the following places:
UNIX:
- Default settings.
- $HOME/.balenarc.yml.$PWD/balenarc.yml
- .BALENARC_
- Environment variables matching .
Windows:
- Default settings.
- %UserProfile%\_balenarc.yml.%cd%\balenarc.yml
- .BALENARC_
- Environment variables matching .
The values from all locations are merged together, with sources listed below taking precedence.
For example:
`sh
$ cat $HOME/.balenarc.yml
balenaUrl: 'balena-staging.com'
projectsDirectory: '/opt/balena'
$ cat $PWD/.balenarc.yml
projectsDirectory: '/Users/balena/Projects'
dataDirectory: '/opt/balena-data'
$ echo $BALENARC_DATA_DIRECTORY
/opt/cache/balena
`
That specific environment will have the following configuration:
`yaml`
balenaUrl: 'balena-staging.com'
projectsDirectory: '/Users/balena/Projects'
dataDirectory: '/opt/cache/balena'
* settings
~get(name) ⇒ \
* ~getAll() ⇒ Object
settings \* - setting value | Param | Type | Description |
| --- | --- | --- |
| name | String | setting name |
Example
`js`
settings.get('dataDirectory')
settings Object - all settings js
settings.getAll()
`Modifying settings
------------------
This module is intended to only provide read only access to the settings. Balena settings client reads settings from various locations, like a local
balenarc file and a per user config file, therefore the module doesn't know where to write changes back.If you want to persist data related to balena, consider using balena settings storage instead.
Support
-------
If you're having any problem, please raise an issue on GitHub and the balena team will be happy to help.
Tests
-----
Run the test suite by doing:
`sh
$ npm test
`Contribute
----------
- Issue Tracker: github.com/balena-io-modules/balena-settings-client/issues
- Source Code: github.com/balena-io-modules/balena-settings-client
Before submitting a PR, please make sure that you include tests, and that coffeelint runs without any warning:
`sh
$ npm run lint
``License
-------
The project is licensed under the Apache 2.0 license.