Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
eu-node-config
Advanced tools
NOTE, THIS IS A WORK IN PROGRESS AND NOT COMPLETE AT THIS TIME To see what works, look at the test(s).
Node config is a simple library for loading configuration from the environment and various file formats. It allows your users to specify their configs in various formats and takes care of parsing the formats appropriately for you.
This module exports only one function: loadConfig
.
var configLoader = require('eu-node-config');
configLoader.loadConfig({
username: {
default: "bob", // A config with a default value can't be required
},
username2: "anotherDefaultFormat",
secure: {
required: true,
error: "Missing required config value: secure" // This default message will be printed if you do not supply your own. This can only be used if the config has a validation, such as required.
},
anotherConfigKey: {
error: true
},
finalConfigKey: {} // This config value will not be required and might not be in the object returned
}, {
configFolders: ['/etc/myconf'], // Optional, defaults to working directory and then process base directory
filePrefix: 'part-before-the-dot', // Optional, defaults to config
order: ["string", "environment", "json", "yaml", "defaults"], // Optional, defaults to the value shown left; earlier values will override later values
// other options include "js" to load from a .js file
configString: '{"key": "value"}', // The 'string' source above.
}, function(err, config) {
console.log("Config loaded: " + config);
});
// Alternately, promise style
configLoader.loadConfig({username: {default: "bob"}, {jsonData: '{"username":"bill"}'})
.then(function(config) {
console.log(Config loaded: " + config);
})
.error(function(err) {
console.log("Failed to load config: " + err);
});
From the above description, your config will be loaded from a file if it begins with your filePrefix (default config) and ends with ".json" or ".yaml". If you enable "loadJsConfigs" it will also load .js extension files.
Environment variables matching either your config key or your config key converted to upper-case and with camelcasing normalized to underscore seperation will be used.
For example, the config key "configKey" will be accessed as either the environment variable "configKey" or "CONFIG_KEY"
FAQs
A simple config file loader
The npm package eu-node-config receives a total of 2 weekly downloads. As such, eu-node-config popularity was classified as not popular.
We found that eu-node-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.
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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.