config.local
install
npm install --save config.local
description
In different enviornments, projects need different config setting. Maybe most config setting is same, but sometimes always has something need special setting. For example, the database on the production config setting is different with the test enviornment or your local envoirnment. The key is the same, but the value maybe not.
how to use
let config = require("config.local");
console.log(config);
file structure
- config folder on the root director.
- config.json file in the config folder.
- config.local.json file in the config folder.
eg:
config.json
{
"name":"Simth",
"work":{
"city":"Beijing",
"company":"IT",
"hisname":"{{name}}"
}
}
config.local.json
{
"name":"Amy",
"work":{
"city":"NewYork",
},
"sex":"man"
}
using in the project.
let config = require("config.local");
console.log(config);
/*
{
"name":"Amy",
"work":{
"city":"NewYork",
"company":"IT",
"hisname":"Amy"
}
}
*/