UNPKG

@webgap/configuration

Version:

WebGAP configurations module. Contains the base Configurations Schema for all webgap components.

62 lines (41 loc) 2.15 kB
# WebGAP Configuration [![Build Status](https://travis-ci.org/webgap/configuration.svg)](https://travis-ci.org/webgap/configuration) [![Test Coverage](https://codeclimate.com/github/webgap/configuration/badges/coverage.svg)](https://codeclimate.com/github/webgap/configuration/coverage) [![Code Climate](https://codeclimate.com/github/webgap/configuration/badges/gpa.svg)](https://codeclimate.com/github/webgap/configuration) [![Dependency Status](https://gemnasium.com/webgap/configuration.png)](https://gemnasium.com/webgap/configuration) [![NPM version](http://img.shields.io/npm/v/@webgap/configuration.svg?style=flat)](https://www.npmjs.com/package/@webgap/configuration) [![NPM downloads](http://img.shields.io/npm/dm/@webgap/configuration.svg?style=flat)](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