
Company News
Socket Has Acquired Secure Annex
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.
Hierarchical configuration with files and environment variables for node and the browser
βββββββββββββ¬ββββββ
β β ββββββ€ ββ β¬β β
ββββββββββ β΄ββββββ
Hierarchical configuration with files and environment variables for node and the browser.
npm i --save configo
1. Create a config folder at the root of your project. Within it, create a default folder.
mkdir config
mkdir config/default
2. Within the default folder, create a private.js file that exports an Object containing your private configuration variables. Once that's done, create a public.js file that does the same but for your publicly accessible configuration variables.
// ./config/default/private.js
module.exports = {
WHO_IS_BATMAN: 'Bruce Wayne'
};
// ./config/default/public.js
module.exports = {
NODE_ENV: process.env.NODE_ENV
};
3. Require configo on the server and in browsers (using browserify) and easily access your configuration variables.
// On the server
var conf = require('configo');
console.log(conf.get('WHO_IS_BATMAN')); // Bruce Wayne
console.log(conf.get('NODE_ENV')); // production
// In browsers
var conf = require('configo');
console.log(conf.get('WHO_IS_BATMAN')); // undefined
console.log(conf.get('NODE_ENV')); // production
NOTE: Your private configuration variables are not included in the outputted browserify file.
Retrieves a key from your config.
Arguments
key - The variable you want to retrieve from your configuration.Examples
var conf = require('configo');
var AWS_SECRET_KEY = conf.get('AWS_SECRET_KEY'); // SUPERSECRETAWSSECRETKEY
Overwrites a variable in your configuration or sets a new one if the variable doesn't exist.
Arguments
key - The name of the variable you want to overwrite or sets it on your configo instance.value - The value you want to store.Examples
var conf = require('configo');
conf.set('FOO', 'bar');
console.log(conf.get('FOO')); // bar
FAQs
Hierarchical configuration with files and environment variables for node and the browser
The npm package configo receives a total of 6 weekly downloads. As such, configo popularity was classified as not popular.
We found that configo 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.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.

Research
/Security News
Socket is tracking cloned Open VSX extensions tied to GlassWorm, with several updated from benign-looking sleepers into malware delivery vehicles.

Product
Reachability analysis for PHP is now available in experimental, helping teams identify which vulnerabilities are actually exploitable.