Add support for configuration stored in database

This is related to issue #22.
However, I get a "$digest already in progress". Without the $apply(),
the initial value is not updated.