GithubHelp home page GithubHelp logo

nsconfig's Introduction

nsconfig NPM version Build Status Coveralls Status

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 devDependency Status

    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 [email protected].

The name nsconfig.json mentioned above can be overridden by setting the environment variable NSCONF with the config file you want to point to. E.g. NSCONF='nsconfig-myproject.json' looks for nsconfig-myproject.json instead of nsconfig.json, using the same methods as mentioned above. This can be useful when working with multiple NetSuite accounts. Please note that this overrides the file name and not the file path.

projectParams

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

The default parameters are:

[
    {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:

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:

{
	"email": "[email protected]",
	"password": "*****",
	"account": "DDAA12321",
	"realm": "system.netsuite.com",
	"role": 3
}

nsconfig's People

Contributors

danieljoppi avatar jacobsvante avatar timaschew avatar wkrueger avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.