Skip to content

Instantly share code, notes, and snippets.

@brycefisher
Created November 12, 2013 16:55
Show Gist options
  • Save brycefisher/7434467 to your computer and use it in GitHub Desktop.
Save brycefisher/7434467 to your computer and use it in GitHub Desktop.
How to Retrieve Environment Variables in Drupal settings.php
<?php
//...
// Store the database credentials serialized in an environmental variable.
$db_creds = unserialize(getenv('DRUPAL_DB_CRED'));
$databases = array (
'default' =>
array (
'default' => $db_creds,
),
);
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment