
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
TypeConf is a universal, typesafe, hierarchical configuration manager for Node.js and the browser.
With TypeConf it's easy to retrieve typed configuration values from different sources:
import TypeConf = require('typeconf');
const conf = new TypeConf()
.withFile('./conf.json');
.withEnv();
const port: number = conf.getNumber('port');
const secret: string = conf.getString('secret');
TypeConf supports different storage backends for configuration values:
minimist)js-yaml)content attributeBackends are queried for existing values in the reverse order that they were added. For example:
const conf = new TypeConf()
.withFile('./conf.json');
.withEnv()
.withArgv();
const example = conf.get('example');
In this case TypeConf will check for existing values in the following order:
--exampleEXAMPLE"example": ...TypeConf can merge and extract nested object properties from environment varibles:
const conf = new TypeConf()
.withStore({
example: {
test: 'test'
}
})
.withEnv();
This example configuration uses a static object store and environment variables. In order to add or override properties on the example object we can do the following:
export EXAMPLE__TEST="override"
export EXAMPLE__OTHER="another property"
By default, TypeConf uses two "underscore" characters (__) as a separator. We can even define completely new objects using this method:
export ANOTHER__A="property a"
export ANOTHER__B__C="property b.c"
const another = conf.getObject('another');
another === { a: 'property a', b: { c: 'property b.c' } };
Use a JavaScript object as a source. Optionally provide a unique name for the store.
Use a supplier function as a source. Optionally provide a unique name for the store.
Node.js only. Use command line arguments as a source. Optionally provide a custom argument parser (uses minimist by default).
Node.js only. Use environment variables as a source. If a prefix is configured, it will be prepended to configuration value names during lookup. The default separator for nested object values is __. For example:
export PREFIX_OBJECT__A="a"
export PREFIX_OBJECT__B__BB="bb"
conf.getObject('object') === { a: 'a', b: { bb: 'bb' } };
Node.js only. Use a configuration file as a source. JSON and YAML (requires js-yaml) are supported.
Browser only. Use a DOM element as a source. The configuration must be a Base64-encoded JSON string in an attribute of the element (default: content). For example:
<meta id="conf" content="eyJhIjoiYiJ9" />
Set an override value.
Delete an override value.
Get a raw value.
Get a value that is transformed by the supplied function.
Get an existing value as a string (using JSON.stringify if necessary) or return an optional fallback string. Throws TypeError if fallback is defined but not a string.
Get an existing value as a number (using parseFloat if necessary) or return an optional fallback number. Throws TypeError if an existing value cannot be interpreted as a number or if fallback is defined but not a number.
Get a value as a boolean. An existing value is always interpreted as true unless it is false or "false". A non-existing value is always interpreted as false.
Get an existing value as an object (using JSON.parse if necessary) or return an optional fallback object. Throws TypeError if an existing value cannot be interpreted as an object or if fallback is defined but not an object.
Get an existing value as an instance of type T (by passing the raw value as the only argument to the constructor) or return an optional fallback value of the same type. Throws TypeError if an error occurs during the instantiation of type T (constructors should validate the raw configuration value).
Aggregate all values from all supported stores as a plain JavaScript object. There are several limitations:
Aggregate all values from all supported stores and encode them as a Base64 JSON string. The same limitations as for toJSON() apply.
FAQs
A typesafe hierarchical configuration manager for Node.js and the browser.
We found that typeconf demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.