uber-node / zero-config

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

Add datacenter support for common.json #26

Open freeqaz opened 9 years ago

freeqaz commented 9 years ago

Adds support for common.DATACENTER.json which is useful to reduce duplication of configuration.

r: @Raynos @lxe @rajeshsegu @malandrew

Raynos commented 9 years ago

:-1: what does common datacenter even mean.

datacenter is a production thing only; you only have a datacenter in production.

freeqaz commented 9 years ago

I keep hitting a wall when testing datacenter-specific stuff. The model that we're using makes it hard to test something, since we keep a test.json environment. So if I want to test, I've got to create test.datacenter.json and keep it in sync with production.datacenter.json. It makes it hard to ensure that the production config is well tested, because it's never actually asserted against.

Having common.datacenter.json allows production to utilize the same set of datacenter-specific config that the test environment is asserting against.

lxe commented 9 years ago

You can just overload the config for any wacky tests with --config=/var/config/some-file.json flag

rajeshsegu commented 9 years ago

I like the idea of common.pek1.json for the same reason of avoiding duplicates between both test.pek1.json and production.pek1.json.

@lxe tests needs to be written against real config data otherwise it would not be good tests.

Raynos commented 9 years ago

@freeqaz test.json is a terrible idea; don't do it.

If you want to test stuff use the seedConfig feature; that's the correct way to test stuff.

We really should remove the test.json feature.

freeqaz commented 9 years ago

You would load production and then override the config with test-specific things?

I don't see seedConfig in the readme. I'll check out the source.

Raynos commented 9 years ago

The option is called "seed". Not "seedConfig"