# nsconfig

> Netsuite Auth Configuration

Latest version **0.5.2** (published 2016-04-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install nsconfig
pnpm add nsconfig
yarn add nsconfig
bun add nsconfig
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.2 |
| Published | 2016-04-08 |
| First published | 2015-10-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | daniel.joppi@suiteplus.com |
| Maintainers | suiteplus |
| Keywords | netsuite, suiteplus, suite, s+ |

## Links

- npm: https://www.npmjs.com/package/nsconfig
- Repository: https://github.com/suiteplus/nsconfig
- Homepage: https://github.com/suiteplus/nsconfig#readme
- Issues: https://github.com/suiteplus/nsconfig/issues
- npm.io page: https://npm.io/package/nsconfig

## Dependencies (2)

- [osenv](https://npm.io/package/osenv.md) ^0.1.3
- [lodash.assign](https://npm.io/package/lodash.assign.md) ^4.0.1

## Recent versions

- 0.5.2 (latest) — 2016-04-08
- 0.5.1 — 2016-04-07
- 0.5.0 — 2016-04-05
- 0.4.1 — 2016-02-05
- 0.4.0 — 2016-01-30
- 0.3.2 — 2016-01-29
- 0.3.1 — 2016-01-29
- 0.3.0 — 2015-10-22
- 0.2.0 — 2015-10-10
- 0.1.0 — 2015-10-09

## README

# nsconfig [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url]

Configuration options for netsuite-related packages.

Set up authentication and custom parameters environment-wise or project-wise.

## Required

 * node.js 0.10+ or io.js 1+ or node.js 4+

## Install [![Dependency Status][david-image]][david-url] [![devDependency Status][david-image-dev]][david-url-dev]
```bash
    npm install nsconfig
```

## Usage

### nsconfig( overrideParams : any , projectParams? : ParamsDef[] , noThrow? : boolean )

Reads configuration parameters from the following sources (overriding each parameter on the same order):

  *  `overrideParams` argument;

  *  Searches up to 5 levels above cwd for a `nsconfig.json` file

  *  Searches for a `~/.ns/nsconfig.json` (on windows `~` is `X:/Users/<user>`)

  *  Environment variables found with the syntax `NSCONF_<UPPERCASE_PARAMETER_NAME>`. E.g. the `email` param can be forced to something else by exporting `NSCONF_EMAIL=email@example.com`.

When working with multiple netsuite environments you may override the file
name `nsconfig.json` with e.g. `nsconfig-myproject.json` by either:

  - setting the `conffile` parameter;

  - setting the environment variable `NSCONF` or `NSCONF_CONFFILE`.


__projectParams__

Set additional parameters that your module may want to look up.

The default parameters are:

```javascript
[
    {name: 'email', required: true},
    {name: 'password', required: true},
    {name: 'account', required: true},
    {name: 'realm', def: 'system.netsuite.com'},
    {name: 'role'}
]
```
Currently accepted options for each custom parameter are:

```typescript
interface ParamsDef {
	name : string;
	required? : boolean; //throws an error if this parameter is not defined
	def? : boolean;      //defaults to this value if this parameter is not defined
}
```

### passwords and passwordHash

Instead of setting the `password` key, you may set `passwordHash` with a base64 encoded password.

Or you may use one the following options in order to avoid storing the password directly into the
project's `nsconfig.json`:

 - Set up the password as environment variable (`NSCONF_PASSWORD`)
 
 - Set the the password at `~/.ns/nsconfig.json`

### Example

Both configuration files below yield the same output:

  * _Raw password:_ [nsconfig.json](./example/nsconfig-simple.json)
  * _Hash password:_ [nsconfig.json](./example/nsconfig-hash.json)

```
var params = nsconfig()
```
yields
```json
{
	"email": "email@suiteplus.com",
	"password": "*****",
	"account": "DDAA12321",
	"realm": "netsuite.com",
	"role": 3
}
```

[travis-url]: https://travis-ci.org/suiteplus/nsconfig
[travis-image]: https://img.shields.io/travis/suiteplus/nsconfig.svg

[coveralls-url]: https://coveralls.io/r/suiteplus/nsconfig
[coveralls-image]: http://img.shields.io/coveralls/suiteplus/nsconfig/master.svg

[david-url]: https://david-dm.org/suiteplus/nsconfig
[david-image]: https://david-dm.org/suiteplus/nsconfig.svg

[david-url-dev]: https://david-dm.org/suiteplus/nsconfig#info=devDependencies
[david-image-dev]: https://david-dm.org/suiteplus/nsconfig/dev-status.svg

[npm-url]: https://npmjs.org/package/nsconfig
[npm-image]: http://img.shields.io/npm/v/nsconfig.svg

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