mashery/iodocs — pull request #137 by rowanhill (2013-12-02 22:25:00+00:00)
Title: Allow API definition dir to be configured in config.json

Hi,

(I've just noticed this is related to pull request #103, although the approach taken here is a bit different, so I'll submit this PR as well.)

Coming out of my question in #134, I think it'd be great to have some way to configure iodocs without having to modify the repository, but whilst easily allowing that configuration under version control.

One way might be to have a git repository with iodocs configuration in it, with iodocs itself as a submodule. This has a few nice features:
- it allows versioning of config (its in a repo of its own)
- it ensures the config stays in sync with the version of iodocs (i.e. you can be sure config will work with the version of iodocs in the submodule)
- it allows for simple updating of iodocs (just update the submodule)

To support this, however, iodocs needs to be able to read the config from outside its directory. This change adds that ability.

There are some downsides, though. In particular, you still need to copy in config.json: it's better than having to copy in config.json _and_ all the API config json files, but it's a fairly small improvement.

I would have loved to allow the location of config.json and the API config json files as command line arguments, but that's not currently supported by `npm start` (see [this](https://github.com/isaacs/npm/issues/3494) issue in npm). If anyone has any better alternatives, I'd be happy to hear them.

Thanks,
Rowan