bigboringsystem/bigboringsystem — pull request #82 by isaacs (2014-12-31 10:47:26+00:00)
Title: Refactor db to a single module, folder, conf value

The better to override in tests, and DRY up a bunch of duplicated code.

It feels like lib/db.js should be some kind of dedicated "manage
multiple levelDBs in a single folder" module or something, but there's a
lot of BBS-specific stuff in there. I'm not level-savvy enough to
confidently predict what other users might want in such a module, so I'm
tempted to just leave it as-is for the next brave soul to figure out.

Configuring the location of the db root folder is super important,
though. Now, you could very easily start the server with something like
`node index.js --db /var/db/bbs` (or env or local.json) and it'll put
all the levels in there. For tests, this makes it easy to wipe the db's
out and not accidentally the non-test databases.

Fixes #67