Skip to content

3axap4eHko/jscfg

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published