Flexible config API for UserCouch.bootstrap()

Bug #1024659 reported by Jason Gerard DeRose
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
UserCouch
Fix Released
High
Jason Gerard DeRose

Bug Description

I'm trying to stabilize the key public bits of the UserCouch API so we can document it and get other folks using it.

The UserCouch.bootstrap() method wasn't very future proof, and didn't give us the flexibility to easily add, say, SSL configuration in the near future. So I'm changing its signature from:

 bootstrap(auth='basic', address='127.0.0.1', tokens=None, loglevel='notice')

To:

 bootstrap(auth='basic', overrides=None)

If supplied, `overrides` should be a dictionary supplying config values. It can override default values like "address" or "loglevel", but it can also provide static values for stuff like "username" or "password" or "oauth". When these values aren't provided, UserCouch.bootstrap() will generate random values for this particular session (like it does now).

This change allows us to easily extend the values we provide in overrides, but without changing the method signature.

One key thing that can't be supplied through `overrides` is the port. I toyed with this idea for a while, but at the end of the day, UserCouch is for starting per-user CouchDB instances, which by definition means the port wont be static. At this point, I don't think it's worth the complexity to make it possible to provide a static port.

However, you can provide any of these things in the `overrides` dictionary:

 * address
 * loglevel
 * username (for auth='basic' or auth='oauth')
 * password (for auth='basic' or auth='oauth')
 * oauth (for auth='oauth')

You can also supply the "salt" used when hashing the password, but that's only intended for testing purposes.

I'm also doing some general code-cleanup to better organize the code and make it easier to review.

Related branches

description: updated
description: updated
description: updated
Changed in usercouch:
status: In Progress → Fix Committed
Changed in usercouch:
status: Fix Committed → Fix Released
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.