balena-settings-client
v5.0.3
Published
Balena client application shared settings
Downloads
40,231
Readme
balena-settings-client
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:
$ 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
.- Environment variables matching
BALENARC_<SETTING_NAME>
.
Windows:
- Default settings.
%UserProfile%\_balenarc.yml
.%cd%\balenarc.yml
.- Environment variables matching
BALENARC_<SETTING_NAME>
.
The values from all locations are merged together, with sources listed below taking precedence.
For example:
$ 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:
balenaUrl: 'balena-staging.com'
projectsDirectory: '/Users/balena/Projects'
dataDirectory: '/opt/cache/balena'
- settings
- ~get(name) ⇒ *
- ~getAll() ⇒ Object
settings~get(name) ⇒ *
Kind: inner method of settings
Summary: Get a setting
Returns: * - setting value
Access: public
| Param | Type | Description | | --- | --- | --- | | name | String | setting name |
Example
settings.get('dataDirectory')
settings~getAll() ⇒ Object
Kind: inner method of settings
Summary: Get all settings
Returns: Object - all settings
Access: public
Example
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:
$ 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:
$ npm run lint
License
The project is licensed under the Apache 2.0 license.