![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
settings-and-secrets
Advanced tools
##settings and secrets
A NodeJS module to help manage configuration settings.
##Getting started
var settings = require('settings-and-secrets')();
var myStr = settings.prop1;
By default the module will look for config.json and secrets.json in the root folder of the project. Environment variables will override config file values. When first adding secrets.json remember to add it to the .gitigrnore file so it doesn't get added to the repository. All settings value will be available as properties of settings.
##Installation
npm install --save settings-and-secrets
##Configuration To add custom settings (which will override any settings of the same name in config.json or secrets.json) pass in a custom settings object as the first argument to the constructor.
var settings = require('settings-and-secrets')({
rootDir: __dirname
});
To change to json files to be used pass in an array of new files (with full paths) as the second argument to the constructor.
var settings = require('settings-and-secrets')(null,['./settings/connectionStrings.json','./settings/urls.json']);
Note that the new files array will replace the existing config file list not merge with it so if you still want to use the default config and secrets files you wil have to add those too.
To ignore environment variables and always use config files values set ignoreEnvVars to true.
var settings = require('settings-and-secrets')(null,null,true);
FAQs
A NodeJS module to help manage configuration settings.
The npm package settings-and-secrets receives a total of 2 weekly downloads. As such, settings-and-secrets popularity was classified as not popular.
We found that settings-and-secrets 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
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.