JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 699
  • Score
    100M100P100Q87007F
  • License UNLICENSED

Config.js file for DigiFi Periodic Applications

Package Exports

  • @digifi/app-config-loader

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@digifi/app-config-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

App-Config-Loader Build Status Coverage Status

Takes db config from either the Azure Key Vault or .env file and returns app configuration for the periodic app.

Required secrets (.env variables) are:

  • CloudProvider (AWS or Azure)
  • ProjectName (string)
  • Environment (string)
  • MongoUrl (string)
  • MongoReplicasetName (string)
  • MongoServerKeepAlive (0 or 1)
  • MongoUseNewUrlParser (0 or 1)
  • MongoConnectTimeout (milliseconds)
  • MongoSocketTimeout (milliseconds)

Getting Started

To begin using the app-config-loader, install the module by running the following command:

$ npm install @digifi/app-config-loader --save

Usage

After installing the app-config-loader, require the module at the top of files where you would like to use it.

const appConfigLoader = require('@digifi/app-config-loader');

Mongo configuration can be retrived using

const mongoConfiguration = appConfigLoader.getMongoConfiguration();

Other secrets can be retrived using

const someSecret = appConfigLoader.getSecret('SomeSecret');

Example Config

Example .env

CloudProvider=AWS
ProjectName=Test App Config
Environment=development
MongoUrl=mongodb://localhost:27017/config_db
MongoReplicasetName=SOME-shard-0
MongoServerKeepAlive=1
MongoUseNewUrlParser=1
MongoConnectTimeout=30000
MongoSocketTimeout=30000