
Security News
The Next Open Source Security Race: Triage at Machine Speed
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.
fnoc is conf backwards. This module automatically and synchronously loads JSON configuration files.
Your Node.js process must run in the root of your app as fnoc uses process.cwd() to determine what files to load. It loads all JSON files in the current directory and any that exist in ./conf or ./config.
npm install fnoc
Let's assume that you have a database configuration file named database.json in your ./config directory and it looks like this:
{
"host": "localhost",
"port": 27017
}
You can then include fnoc and it will automatically load this file. If fnoc is included in more than one module, it will not load the modules more than once.
var configs = require('fnoc');
console.log(configs.database.host); //localhost
console.log(configs.database.port); //27017
//automatically loads package.json
console.log(configs.package.name); //YOUR PACKAGE NAME
It will not load nor crash if a JSON file can't be parsed.
Now Let's assume that your database configuration file looks like this:
{
"development": {
"name": "myapp_development",
"host": "127.0.0.1",
"port": 27017
},
"test": {
"name": "myapp_test",
"host": "127.0.0.1",
"port": 27017
},
"production": {
"name": "myapp_production",
"host": "myserver.com",
"port": 27017
}
}
Now if you call the env() method:
var configs = require('fnoc').env()
console.log(configs.database.name); //output depending upon NODE_ENV
Test Environment:
NODE_ENV=test node myapp.js
yields...
console.log(configs.database.name); //myapp_test
You can still access regular JSON config files that do not have environment specific keys such as package.json. If the file has the environment key, it's chopped to only that configuration information.
npm test
or...
mocha test
Licensed under MIT. See LICENSE for more details.
Copyright (c) 2012 JP Richardson
FAQs
A a simple module to load config files.
The npm package fnoc receives a total of 5 weekly downloads. As such, fnoc popularity was classified as not popular.
We found that fnoc 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
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.

Research
/Security News
Malicious dYdX client packages were published to npm and PyPI after a maintainer compromise, enabling wallet credential theft and remote code execution.

Security News
gem.coop is testing registry-level dependency cooldowns to limit exposure during the brief window when malicious gems are most likely to spread.