Load Aegir's site credentials from a php function I'm using Aegir and want to inject some data into a site's vhost.
And I managed to do it thanks to this post.

My problem is I can't find an Aegir function to load a site's dabase configurations from this Aegir functions listing to do it programmatically on each site-verify.

I need to find a function or method that would return a site's data:


db_name
db_user
db_passwd
etc


I tried Provision_Config('mysite.com') but I have a template argument missing error.

Does anyone know which function I should use to get the data?
I usually use drush sql-connect in ssh, but here I'm not sure it would be a clean way as it should be in a php script.

The goal is to make Drupal work with multi-site / multi-folder (I'm aware of that post and patch, but my solution seems to work for me without having to patch anything):

&lt;VirtualHost *:80&gt;
  DocumentRoot /var/aegir/platforms/myplatform

  ServerName mysite1.com
  SetEnv db_type  mysql
  SetEnv db_name  mydbname_1
  SetEnv db_user  mydbname_1
  SetEnv db_passwd  *********
  SetEnv db_host  localhost
  SetEnv db_port  9854

  # Credentials from other Aegir's site
  # located in a subfolder /blog.
  &lt;Location /blog&gt;
    SetEnv db_type  mysql
    SetEnv db_name  mydbname_2
    SetEnv db_user  mydbname_2
    SetEnv db_passwd  *********
    SetEnv db_host  localhost
    SetEnv db_port  1258
  &lt;/Location&gt;

&lt;/VirtualHost&gt;
Installing sites in sub-directories is supported in Aegir 2+ without any such hacking. Just enable the "Site subdirectories" feature, under the 'experimental' group at admin/hosting/features.

That said, to answer your question, DB credentials are available via drush_get_context('site').