Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
import { Confeta, types } from 'confeta'
import ConfetaEnv from 'confeta-env'
import ConfetaArgv from 'confeta-argv'
import ConfetaFile from 'confeta-file'
import changeCase from 'change-case'
let config = Confeta({
mongoUrl: {
type: types.string,
description: 'Mongo Url',
default: 'mongo://localhost:27017'
},
timeout: {
type: types.integer
},
host: {
type: { // nested object
domain: {
type: types.string,
description: 'Domain name',
required: true
},
port: {
type: types.integer,
description: 'Port',
required: true
}
}
}
})
.addSource(ConfetaEnv({prefix: 'MYAPP__', separator: '__'}), changeCase.constantCase)
.addSource(ConfetaArgv())
.addSource(ConfetaFile({parseFn: JSON.parse, path: 'config.json'}))
.build()
Full example can be seen in ./example
I got tired of nconf inability to handle different naming conventions between different sources (e.g. CONSTANT_CASE in process.env vs camelCase in json file). So I created a new, more customisable library where you can specify schema for your configuration and map schema names to different sources. With schema you can specify exactly what type do you expect and avoid annoying situation when you have to parse value manually after getting it from config. Also some simple validation I think is nice.
Yes, core confeta
package has no sources in it. You have to either install a separate package with source you need for your app or implement your own one (which is very simple btw)
Officially supported sources:
options:
Returns object containting all settings fetched from sources
It's very simple, all you have to do is provide object which exposes .get(segments)
function. It will be called every time Confeta tries to fetch value and segments
will be an array of strings which represents a path to value in a schema tree.
MIT
FAQs
Confeta core package
We found that confeta 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
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.