Protected
dataData storage
Static
Readonly
TemplateTemplate enabling settings
Static
Private
_rootdata path
Optional
def: Tdefault value
Optional
Get config property by path
import { Config } from '@biorate/config';
const config = new Config();
config.set('a', 1);
console.log(config.get('a')); // 1
console.log(config.get('b', 2)); // 2
console.log(config.get('b')); // UndefinedConfigPathError: Undefined config path [b]
// at Config.get (src/index.ts:2:1608)
// at Context.<anonymous> (tests/index.spec.ts:19:24)
// at processImmediate (node:internal/timers:464:21)
Protected
initializeProtected
loaddata object
Merge config data
import { Config } from '@biorate/config';
const config = new Config();
config.merge({
a: { b: { c: 1 } },
});
config.merge({
a: { b: { d: 2 } },
});
console.log(config.has('a')); // true
console.log(config.has('a.b')); // true
console.log(config.get('a.b.c')); // 1
console.log(config.get('a.b.d')); // 2
Protected
templateProtected
templatizeStatic
rootChange application root. Application root is equal process.cwd() by default
FileConfig.root('/www/my-app/');
container.bind<IConfig>(Types.Config)
.to(FileConfig.root('/www/my-app/'))
.inSingletonScope();
Generated using TypeDoc
Description
Module for configuring the application using files, extends Config base class.
Features:
How to use:
In cwd of you app, near package.json, create 2 files:
Example