uber-node / zero-config

A zero configuration configuration loader
MIT License
116 stars 10 forks source link

support a seed option #2

Closed Raynos closed 9 years ago

Raynos commented 9 years ago

This adds a seed option to the zero-config module.

This use case is currently done adhoc in the server.js of applications using zero-config.

cc @Matt-Esch @sh1mmer

lxe commented 9 years ago

:+1:

Can we also make a 'defaults' option? Just like seed, except all the config-chain items overwrite it, instead of it overwriting them?

Raynos commented 9 years ago

defaults is called config/common.json use json files.

lxe commented 9 years ago

@Raynos I don't want defaults to be project-dependent, but rather module-dependent. Let's say you'd like to use bedrock (without playdoh):

var bedrock = require('bedrock');
bedrock.createServer(function (server) {
  server.get('/', function (req, res) { res.send('Hello!'); });
  server.listen();
});

That will just crash, because you need to also write a giant file (or copy it from somewhere?) into your project/config/common.json. Not sure if that's a good pattern (especially for "zero-config"... might as well call it "lots-of-config" :P ).

Raynos commented 9 years ago

config is part of your app and will stay in your app.

We already scaffold a ton of shit, might as well scaffold config too.

Putting it into a shared library puts you in update hell.