
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
diamorphosis
Advanced tools
Use
to configure your application for different environments (NODE_ENV). Supports defaults. Supports nested values.
$ npm install diamorphosis
// file: config/config.js
{
my_var_a : "some value",
myVarB: "some value"
}
// file: config/env/production.json
{
"nested":{
"my_var_a" : "some production value",
"myVarB": "some production value"
}
}
To enable the production configuration set NODE_ENV=production
export NESTED_MY_VAR_A=someScalarValue
export NESTED_MY_VAR_B=this,var,is,an,array,of,values // NESTED_MYVARB is also supported
export NESTED_BOOLEAN=true
NESTED_MY_VAR_A=someValue
// file: config/config.js
// var names should be snakecase (a_var_example) in order to be able to overwrite them correctly using env vars.
module.exports =
{
varOne: '1_dev_',
nestedExample: {
varTwo: '2_dev_'
}
}
// file: config/evn/production.json
{
"varOne": '1_prod',
"nestedExample": {
"varTwo": "2_prod"
}
}
// file: config/evn/other.json
{
"varOne": '1_other',
"nestedExample": {
"varTwo": "2_other"
}
}
// file: app.js
const diamorphosis = require('diamorphosis');
diamorphosis({ // these are the default values
configFolder: './config',
configPath: './config/config.js',
envFolder: './config/env',
loadDotEnv: ['development'] // will only load .env if NODE_ENV=development
})
// file: myFile.js
const config = require('./config/config');
console.log(var_one:', config.var_one);
console.log(var_two:', config.nested_example.varTwo);
// Env vars can overwrite the config values. The app will need a restart to load the new values:
// export VAR_ONE="some other value for var one"
// export NESTED_EXAMPLE_VAR_TWO="some other value for var two"
# file .env
VAR_ONE=value
Config.js can use the es6 export default eg:
export default {
varOne: '1_dev_',
nestedExample: {
varTwo: '2_dev_'
}
}
This is especially useful if you are using diamorphosis with typescript.
Note that env files can have .json or .js extension
MIT
FAQs
Use - JSON file(s) - .env file for development - ENV vars
The npm package diamorphosis receives a total of 358 weekly downloads. As such, diamorphosis popularity was classified as not popular.
We found that diamorphosis demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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 won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.