balena-settings-client is a low-level utility module designed to provide read-only access to user-configurable balena application settings. It consolidates configuration from various sources, including default settings, user-specific `.balenarc.yml` files (e.g., `$HOME/.balenarc.yml` on Unix), project-specific `.balenarc.yml` files (`$PWD/balenarc.yml`), and environment variables prefixed with `BALENARC_`. Values are merged with a clear precedence hierarchy, allowing for flexible overrides. The current stable version is 6.0.3, with recent releases indicating active maintenance and development. Key differentiators include its role in the balena ecosystem for managing client-side settings, its ability to merge configurations from multiple sources, and its explicit read-only nature. This module is not intended for direct end-user consumption; instead, users are typically directed to the higher-level `balena-sdk` for interacting with balena services.
npm install balena-settings-clientVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the balena-settings-client, read individual settings using `settings.get()`, and retrieve all loaded settings with `settings.getAll()`. It shows how settings from a local `balenarc.yml` file and environment variables are automatically merged and accessed.
Upgrade your Node.js environment to version 20.12.0 or newer. Consider using a Node.js version manager like `nvm` to manage multiple Node.js installations.
Refactor code to retrieve the top-level object and then access nested properties manually. For example, instead of `settings.get('api.url')`, use `const apiSettings = settings.get('api'); const url = apiSettings?.url;`Do not attempt to modify settings through this client. If you need to write configuration, use a dedicated storage mechanism or a higher-level SDK like `balena-sdk` if appropriate for your use case.
Evaluate if your use case truly requires direct access to `balena-settings-client`. For most applications, integrating with `balena-sdk` is the recommended approach for managing balena-related configurations.
Review your codebase for any indirect dependencies on `lodash` or `Bluebird` through `balena-settings-client`. If found, refactor to use `es-toolkit` or native JavaScript alternatives, or explicitly import `lodash`/`Bluebird` if they are direct dependencies of your project.
Change your import statement from `const settings = require('balena-settings-client');` to `import settings from 'balena-settings-client';`. Ensure your project's `package.json` has `"type": "module"` or uses `.mjs` file extensions for ESM.Verify that `balena-settings-client` is imported as `import settings from 'balena-settings-client';` and that `settings.get()` is called on the default exported object.
Instead of `settings.get('parent.child')`, first get the parent object: `const parent = settings.get('parent');` then access the child property: `const child = parent?.child;`.Update your Node.js environment to version 20.12.0 or newer. Use a tool like `nvm` (Node Version Manager) to easily switch Node.js versions.
No dependency data recorded yet.