Configuring Modules in Install Profile
In general using hook_install or hook_enable or a hook_update function in a module is prefered over hardcoding the value in settings.php of your drupal site.

Another option is to use the Configuration module or Features to encapsulate your database configuration to code to be enabled on the drupal website.