config - hardened db cred gathering

Hardened the code that gathers db credentials.

Change-Id: I3e04fa2273cce2ddde060bd124604caca2af90f1
Signed-off-by: Sandro Bonazzola <sbonazzo@redhat.com>