@webgap/configuration
Version:
WebGAP configurations module. Contains the base Configurations Schema for all webgap components.
62 lines (41 loc) • 2.15 kB
Markdown
# WebGAP Configuration
[](https://travis-ci.org/webgap/configuration)
[](https://codeclimate.com/github/webgap/configuration/coverage)
[](https://codeclimate.com/github/webgap/configuration)
[](https://gemnasium.com/webgap/configuration)
[](https://www.npmjs.com/package/@webgap/configuration)
[](https://www.npmjs.com/package/@webgap/configuration)
# README
This is the base configurations module for WebGAP. Contains base configurations Schema for all WebGAP components.
# Dependencies
Handles configurations using [**node-convict**](https://github.com/mozilla/node-convict).
# Requirements
This module uses 2 environment variables. Only environment variables, no options parameters, are used in order
to make sure the configurations and configurations schema is loaded once and only once
([Caching Caveats](https://nodejs.org/api/modules.html#modules_module_caching_caveats)).
The module loads a configuration JSON file:
```bash
NODE_APP_CONF - Full path to the configuration file
```
The module holds a default schema for configurations used by WebGAP. If you want to use your own,
it can be overridden using the following environment variable:
```bash
NODE_APP_CONF_SCHEMA - Full path of an alternative configurations schema
```
# API
## Installation
```bash
npm install @webgap/configuration --save
```
## Usage
```javascript
var configuration = require('@webgap/configuration');
...
var tokenSecret = configuration.get('GENERAL.TOKEN.SECRET');
...
```
## Schema
Check the file [**configurations-schema.json**](https://github.com/webgap/configuration/blob/master/configurations-schema.json)
for schema definition.
# License
Apache License, Version 2.0