# resin-settings-client

> Resin.io client application shared settings

Latest version **3.8.8** (published 2018-07-20) · Apache-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install resin-settings-client
pnpm add resin-settings-client
yarn add resin-settings-client
bun add resin-settings-client
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.8.8 |
| Published | 2018-07-20 |
| First published | 2015-03-18 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 138 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Juan Cruz Viotti |
| Maintainers | resin.io |
| Keywords | resin, settings, client |

## Links

- npm: https://www.npmjs.com/package/resin-settings-client
- Repository: https://github.com/resin-io-modules/resin-settings-client
- Issues: https://github.com/resin-io-modules/resin-settings-client/issues
- npm.io page: https://npm.io/package/resin-settings-client

## Dependencies (8)

- [lodash](https://npm.io/package/lodash.md) ^4.15.0
- [js-yaml](https://npm.io/package/js-yaml.md) ^3.4.0
- [hidepath](https://npm.io/package/hidepath.md) ^1.0.0
- [home-or-tmp](https://npm.io/package/home-or-tmp.md) ^2.0.0
- [@types/lodash](https://npm.io/package/@types/lodash.md) 4.14.108
- [@types/js-yaml](https://npm.io/package/@types/js-yaml.md) 3.11.1
- [@resin.io/types-hidepath](https://npm.io/package/@resin.io/types-hidepath.md) 1.0.1
- [@resin.io/types-home-or-tmp](https://npm.io/package/@resin.io/types-home-or-tmp.md) 3.0.0

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 3.8.8 (latest) — 2018-07-20
- 3.8.7 — 2018-05-02
- 3.8.6 — 2018-05-02
- 3.8.1 — 2017-11-01
- 3.8.0 — 2017-09-25
- 3.7.0 — 2017-08-31
- 3.6.1 — 2017-04-21
- 3.6.0 — 2017-04-19
- 3.5.2 — 2016-10-03
- 3.5.1 — 2016-09-08
- 3.5.0 — 2016-04-22
- 3.4.2 — 2016-02-03
- 3.4.1 — 2015-12-04
- 3.4.0 — 2015-11-16
- 3.3.1 — 2015-11-16
- … 15 more at https://npm.io/package/resin-settings-client/versions

## README

resin-settings-client
---------------------

[![npm version](https://badge.fury.io/js/resin-settings-client.svg)](http://badge.fury.io/js/resin-settings-client)
[![dependencies](https://david-dm.org/resin-io-modules/resin-settings-client.png)](https://david-dm.org/resin-io-modules/resin-settings-client.png)
[![Build Status](https://travis-ci.org/resin-io-modules/resin-settings-client.svg?branch=master)](https://travis-ci.org/resin-io-modules/resin-settings-client)
[![Build status](https://ci.appveyor.com/api/projects/status/a1tfwovw1kp421sa?svg=true)](https://ci.appveyor.com/project/jviotti/resin-settings-client)

Join our online chat at [![Gitter chat](https://badges.gitter.im/resin-io/chat.png)](https://gitter.im/resin-io/chat)

Resin.io client application shared settings.

Role
----

The intention of this module is to provice low level access to user configurable Resin.io 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 [Resin SDK](https://github.com/resin-io/resin-sdk) instead.

Installation
------------

Install `resin-settings-client` by running:

```sh
$ npm install --save resin-settings-client
```

Documentation
-------------

This module attempts to retrieve configuration from the following places:

**UNIX:**

- Default settings.
- `$HOME/.resinrc.yml`.
- `$PWD/resinrc.yml`.
- Environment variables matching `RESINRC_<SETTING_NAME>`.

**Windows:**

- Default settings.
- `%UserProfile%\_resinrc.yml`.
- `%cd%\resinrc.yml`.
- Environment variables matching `RESINRC_<SETTING_NAME>`.

The values from all locations are merged together, with sources listed below taking precedence.

For example:

```sh
	$ cat $HOME/.resinrc.yml
	resinUrl: 'resinstaging.io'
	projectsDirectory: '/opt/resin'

	$ cat $PWD/.resinrc.yml
	projectsDirectory: '/Users/resin/Projects'
	dataDirectory: '/opt/resin-data'

	$ echo $RESINRC_DATA_DIRECTORY
	/opt/cache/resin
```

That specific environment will have the following configuration:

```yaml
	resinUrl: 'resinstaging.io'
	projectsDirectory: '/Users/resin/Projects'
	dataDirectory: '/opt/cache/resin'
```


* [settings](#module_settings)
    * [.get(name)](#module_settings.get) ⇒ <code>\*</code>
    * [.getAll()](#module_settings.getAll) ⇒ <code>Object</code>

<a name="module_settings.get"></a>

### settings.get(name) ⇒ <code>\*</code>
**Kind**: static method of [<code>settings</code>](#module_settings)  
**Summary**: Get a setting  
**Returns**: <code>\*</code> - setting value  
**Access**: public  

| Param | Type | Description |
| --- | --- | --- |
| name | <code>String</code> | setting name |

**Example**  
```js
settings.get('dataDirectory')
```
<a name="module_settings.getAll"></a>

### settings.getAll() ⇒ <code>Object</code>
**Kind**: static method of [<code>settings</code>](#module_settings)  
**Summary**: Get all settings  
**Returns**: <code>Object</code> - all settings  
**Access**: public  
**Example**  
```js
settings.getAll()
```

Modifying settings
------------------

This module is intended to only provide *read only* access to the settings. Resin Settings Clients reads settings from various locations, like a local `resinrc` 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 Resin.io, consider using [Resin Settings Storage](https://github.com/resin-io-modules/resin-settings-storage) instead.

Support
-------

If you're having any problem, please [raise an issue](https://github.com/resin-io-modules/resin-settings-client/issues/new) on GitHub and the Resin.io team will be happy to help.

Tests
-----

Run the test suite by doing:

```sh
$ npm test
```

Contribute
----------

- Issue Tracker: [github.com/resin-io-modules/resin-settings-client/issues](https://github.com/resin-io-modules/resin-settings-client/issues)
- Source Code: [github.com/resin-io-modules/resin-settings-client](https://github.com/resin-io-modules/resin-settings-client)

Before submitting a PR, please make sure that you include tests, and that [coffeelint](http://www.coffeelint.org/) runs without any warning:

```sh
$ npm run lint
```

License
-------

The project is licensed under the Apache 2.0 license.

---
_Source: https://npm.io/package/resin-settings-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
