append settings.php during profile installation
Checkout this post about Collecting and writing configuration settings to setting.php from an install profile.

It describes how a custom task (via hook_install_tasks_alter()) was injected into the installation profile to display a custom form and, upon submission, how drupal_rewrite_settings() can be used to inject the custom settings into settings.php.