I need to load DB configuration dynamically in Drupal 7
Drupal allows you to override settings using the $conf[] array in settings.php. They will be then available via variable_get('key', 'default') in any module.

See 'defining site variables' 
and variable_get()

The pattern we use is that any defaults go into install.php. starts with:

function hottopicsnotify_install() {
  variable_set(HOTTOPICSNOTIFY_CONTENT_TYPES_VAR, 'hottopics_node_form');


Override the variables with an admin form where needed. e.g.  

function hottopics_settings($form, &amp;$form_state) {


Read using variable_get. e.g.: 

'#default_value' =&gt; variable_get(HOTTOPICSNOTIFY_EDITORIAL_CRON_KEY, ''),