
Security News
Nx npm Packages Compromised in Supply Chain Attack Weaponizing AI CLI Tools
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
config-guardian
Advanced tools
Configuration Guardian is a tool that allows you to specify configuration details throughout your application and have it all loaded at a go.
Recursively goes through all folders starting from the folder you called ConfigGuardian from and includes all keys inside *.config.js files into ConfigGuardian.
// ...
ConfigGuardian({ /* :options */ });
// ...
module.exports = {
key1: 1,
key2: 1.123
};
const config = require('config-guardian');
config.key1; // 1
Below is a complete list of all options.
projectRoot : String
- defaults to the directory of the calling file.
environments : Array
refresh : Boolean
- if this is set to true, ConfigGuardian will reconfigure itself regardless of current state
ignore : Array
- a list of directory names that should not be processed during the recursive descent
The first time ConfigGuardian() is called, it initialises itself and does a recursive
descent through the folders starting from projectRoot, collating the exported properties
from files ending with .config.js
, placing the keys into itself.
On second and subsequent calls, ConfigGuardian() returns an object with all the keys of
all files ending with .config.js
for your use.
EnvConfig is a structure you can use to define different values for different environments
depending on the environments
options you passed into the intiial constructor. If the
environments
options contains 'test', 'dev', 'stage', 'prod'
, calling
new EnvConfig('testValue', 'devValue', 'stageValue', 'prodValue')
will result in a
hash:
{
test: 'testValue',
dev: 'devValue',
stage: 'stageValue',
prod: 'prodValue'
}
Added envs
option to specify events and create environment configs with
ConfigGuardian.EnvConfig();
Added ignore
option to ignore certain file names so that node_modules
does not
get included.
Initial release
FAQs
Configuration Guardian is a tool that allows you to specify configuration details throughout your application and have it all loaded at a go.
We found that config-guardian 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
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.