Generalization to provide more flexibility in postgresql configuration
Cleaned up and added unit tests

Signed-off-by: Ken Barber <ken@bob.sh>