Skip to content

Instantly share code, notes, and snippets.

@geerlingguy
Created April 28, 2016 15:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geerlingguy/d127ca618e12de3639190d80054b2e5c to your computer and use it in GitHub Desktop.
Save geerlingguy/d127ca618e12de3639190d80054b2e5c to your computer and use it in GitHub Desktop.
Acquia Cloud Site Factory Environment Detection
<?php
/**
* Acquia Cloud Site Factory Environment detection examples.
*/
// This may require the ACSF module to be installed.
// @see https://www.drupal.org/project/acsf
$site settings = [
'site' => '',
'env' => '',
];
if (!empty($GLOBALS['gardens_site_settings'])) {
$site_settings = $GLOBALS['gardens_site_settings'];
}
// $stage will print the current environment name.
require_once '/var/www/site-scripts/site-info.php';
list($name, $group, $stage, $secret) = ah_site_info();
@geerlingguy
Copy link
Author

It seems like the code in 16-18 is preferred in terms of reliability and non-dependence on the ACSF connector module. Regardless, there are a couple ways you can get at environment config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment