mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
34 lines
766 B
TypeScript
34 lines
766 B
TypeScript
import Settings = require('settings');
|
|
|
|
// works without options
|
|
new Settings('foo');
|
|
|
|
// works with path to module containing settings
|
|
const settings = new Settings('./path/to/my/config');
|
|
// any prop is accessible on returned value
|
|
settings.hello = 'world';
|
|
const foo = settings.bar;
|
|
|
|
// works with settings object
|
|
const settings2 = new Settings({
|
|
common: {setting: 'mySetting'}, production: {
|
|
hello: 'bar'
|
|
}
|
|
});
|
|
settings2.hello = 'world';
|
|
|
|
// allows for forceEnv in settings object
|
|
const settings3 = new Settings({
|
|
common: {},
|
|
forceEnv: 'production'
|
|
});
|
|
|
|
// allows options
|
|
const settings4 = new Settings('./path/to/my/settings', {
|
|
root: 'someRoot',
|
|
env: 'development',
|
|
defaults: {
|
|
someSetting: 'settingValue'
|
|
}
|
|
});
|