jscfg
TypeScript icon, indicating that this package has built-in type declarations

0.3.3 • Public • Published

JS Config

Coverage Status Build Status NPM version Downloads Snyk

Usage

Check ascertain doc for more examples

Common config file

// config/common.js
import { set } from 'jscfg';

set({
  app: {
    id: 'appId',
    secret: 'appSecret',
  }
});

Environment specific file

// config/production.js
import { set } from 'jscfg';

set({
  database: 'production-connection-string',
});

Application entry point

// index.js
import config, { assert } from 'jscfg';
import './config/common';
import './config/production';
import appStart from './application';

assert({
  app: {
    id: String,
    secret: String,
  }
});

appStart(config.app);

Database module

// index.js
import config, { assert } from 'jscfg';
import connect from 'my-db-driver';

assert({
  database: String,
});

connect(config.database);

License

License The MIT License Copyright (c) 2019 Ivan Zakharchanka

Package Sidebar

Install

npm i jscfg

Weekly Downloads

0

Version

0.3.3

License

MIT

Unpacked Size

7.06 kB

Total Files

9

Last publish

Collaborators

  • 3axap4ehko