
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Simple server-side file-based configuration manager
npm install nb-config --save
DEFAULT FILE: ./config/default.js
value1: hello
value2: world
CONFIG FILE: ./config/development.js
value1: hi
./your.js
const Config = require('nb-config');
let config = new Config();
console.log(config.get('value1'), config.get('value2'));
output
# node your.js
hi world
example project directory
|/
|--src/
|----your.js
|--config/
|----myProject.default.yaml
|----myProject.development.yaml
|----myProject.production.yaml
load configuration with specific moduleName(default: name field on package.json) and runningTarget(default is 'development')
const Config = require('nb-config');
let config = new Config('myProject', 'production');
// config will contains data in myProject.default.js + myProject.production.yaml
runningTarget could be replace with environment NODE_ENV
const Config = require('nb-config');
let config = new Config('myProject');
// test with NODE_ENV=production node ./src/your.js
// will returns same value with above example
example project directory
|/
|--src/
|----your.js
|--config/
|----myProject.development.yaml
|----myProject.production.yaml
|--myProject.default.yaml
docker dataVolume : /host/myProject/config:/container/config
|config/
|--myProject.development.yaml
|--myProject.production.yaml
Once the data volume is mounted in the container, all of the files in the container will be erased.
The problem is even default file also will be erased.
In this case nb-config will useful.
const Config = require('nb-config');
let config = new Config('myProject', null, {
defaultDir: process.cwd()
});
After data-volume mounted, nb-config will copy ./myProject.default.yaml into empty /config directory
Now, docker host can see full schemed default file in data-volume
constructor(['moduleName'], ['runningTarget'], [{options}])
initialize and load configurations
If this field specified, NBConfig will use this moduleName as prefix of configuration files
// it will load default.yaml + development.yaml
let config1 = new NBConfig();
// it will load myProject.default.yaml + myProject.development.yaml
let config2 = new NBConfig('myProject');
Order of reading runningTarget
Once the value is found, the rest is passed.
config.fromCache marked true__ is a default delimiter of configuration path (e.g. path database.url --> EXPORT database__url=URL_VALUE)options.configDir > process.env.NB_CONFIG_DIR > process.cwd()/config(as default)options.defualtDir > process.env.NB_DEFAULT_DIR > same value as configDir(as default)Copyright 2016 Noizbuster <noizbuster@noizbuster.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
FAQs
simple configuration manager
The npm package nb-config receives a total of 3 weekly downloads. As such, nb-config popularity was classified as not popular.
We found that nb-config 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.