node-app-configdeprecated

simple application config class

Usage no npm install needed!

<script type="module">
  import nodeAppConfig from 'https://cdn.skypack.dev/node-app-config';
</script>

README

node-app-config

Simple class that parses a config json file and exposes the contents on the class

Requires Node v6.x +

typescript friendly

install

$npm install node-app-config

usage

var AppConfig = require('node-app-config');

var config = new AppConfig(); //this will work if your config is in the process.cwd() and the file is named config.json

console.log(config.mySetting);
console.log(process.appConfig.mySetting);

alternatively you can specify a config file path in the constructor

var AppConfig = require('node-app-config');

//this config file path can be relative to process.cwd()
//to use an absolute path use new AppConfig([path], false);
var config = new AppConfig('../path/to/config');

console.log(config.mySetting);
console.log(process.appConfig.mySetting);

ERRORS

the object constructor will throw exceptions if the config file does not exist or is invalid json

license

MIT