@janiscommerce/settings
v1.0.1
Published
[![Build Status](https://travis-ci.org/janis-commerce/settings.svg?branch=master)](https://travis-ci.org/janis-commerce/settings) [![Coverage Status](https://coveralls.io/repos/github/janis-commerce/settings/badge.svg?branch=master)](https://coveralls.io/
Downloads
6,110
Readme
settings
Installation
npm install @janiscommerce/settings
API
Settings.get(string) static
- This method returns settings or settings by key. Example: Settings.get(); Example: Settings.get('database');
Setting file
The setting file is a JSON with all the settings.
It's located in path/to/root/[MS_PATH]/config/.janiscommercerc.json
.
[MS_PATH]
: ENV variable. Default is empty.
Example
{
"database": {
"core": {
"host": "my-host",
"user": "the-user"
},
"otherConn": {
"host": "my-other-host",
"user": "other-user"
}
},
"otherConfig": 123,
"mainPath": "/main/path/"
}
Usage
How to get settings
const Settings = require('janiscommerce/settings');
const settings = Settings.get();
How to get settings by key
const Settings = require('janiscommerce/settings');
const settings = Settings.get('database');