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 The MIT License Copyright (c) 2019 Ivan Zakharchanka