Squashed commit of the following:

commit 22bc88556f53a9f598e96ba109a06c5c15672137
Author: Ilya Anisimoff <ilya@intersect.org.au>
Date:   Tue Dec 10 11:40:15 2013 +1100

    MISC: Flushes pgpass tempfile before reading

commit 7263424745929d5b16e707b65f71f4e169bc91d3
Author: Ilya Anisimoff <ilya@intersect.org.au>
Date:   Mon Dec 9 13:59:21 2013 +1100

    MISC: Try to get db_config vars

commit 1417a028198e0304efc2287ebb2addb5affda1ab
Author: Ilya Anisimoff <ilya@intersect.org.au>
Date:   Mon Dec 9 09:27:41 2013 +1100

    MISC: Temporarily revert database config

commit 7656e9ca57ddbaf808a2b62e5e89a7d074bb67ee
Author: Ilya Anisimoff <ilya@intersect.org.au>
Date:   Mon Dec 9 09:18:09 2013 +1100

    MISC: Adds rake trace flag

commit 279d53a1d0c7837f13512986cf4e7fe404be3fed
Author: Ilya Anisimoff <ilya@intersect.org.au>
Date:   Mon Dec 9 09:06:46 2013 +1100

    MISC: More environment variable dumping

commit da16ea4b08b4438c7400ba7837b17ed03d4b3cc5
Author: Ilya Anisimoff <ilya@intersect.org.au>
Date:   Mon Dec 9 09:01:27 2013 +1100

    MISC: Dump environment variables for new_secret task

commit e8481be420d1a111f08e0a1b514ecb9049edebfc
Author: Ilya Anisimoff <ilya@intersect.org.au>
Date:   Fri Dec 6 16:26:33 2013 +1100

    MISC: More database config updates

commit eda4523fe8d80628892b46b43837b0c2a92276d1
Author: Ilya Anisimoff <ilya@intersect.org.au>
Date:   Fri Dec 6 16:17:00 2013 +1100

    MISC: Updates database settings

commit 064068b76f3bf42899013ef45df3280a67cc0086
Author: Ilya Anisimoff <ilya@intersect.org.au>
Date:   Fri Dec 6 15:48:29 2013 +1100

    MISC: Adds additional db adapter debugging info

commit 09462a8009adc95a6e9c2ca584c1f5b7d686584c
Author: Ilya Anisimoff <ilya@intersect.org.au>
Date:   Fri Dec 6 15:31:24 2013 +1100

    MISC: Adds trake to db:backup rake task
Merge branch 'cap_debug' of github.com:IntersectAustralia/nedb into cap_debug