Comments (4)
Hey @meaku
I created a PR, that follows your suggestion. Instead of Object.assign
I used the deep-assign module, because of two reasons:
Object.assign
is not available in node 0.12Object.assign
is only shallow, but imho it should be possible to also overwrite nested properties without specifying the whole child object chain in the overwrite file
Let me know what you think 😄
Ben
from dynamic-config.
Thanks for your proposal @benurb!
I like the idea of having a local config. It could be a plugin and used if needed.
Another option would be to add the logic to your config.js
//config/index.js
const path = require("path");
const dynamicConfig = require("dynamic-config");
let localConfigPath = path.join(__dirname, "config.local.js");
let config = dynamicConfig(__dirname, "config.js");
if(fs.existsSync(localConfigPath) {
config = Object.assign(config, fs.readFileSync(localConfigPath));
}
module.exports = config;
But i'd be happy with a PR adding this functionality as a plugin 👍
We already have an extend
plugin which reads from env
and argv
. Maybe it's extend/file
or extend/localfile
?
from dynamic-config.
Looks good! I added some comments about some copy & paste things. If you agree this PR can land :)
from dynamic-config.
Already landed in 207cd1e. Thank you guys 👍
from dynamic-config.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dynamic-config.