function _instance_settings_get_environment in Instance settings 7.2
Get current environment based on passed method.
Parameters
string $site_dir: Site config directory.
string $method: Method to used to determine current environment.
Return value
string Current environment.
1 call to _instance_settings_get_environment()
- _instance_settings_init_params in includes/
include.settings.inc - Initialize Instance settings.
File
- includes/
include.settings.inc, line 337
Code
function _instance_settings_get_environment($site_dir, $method = 'env_file') {
if ($method == 'env_file') {
// This is only settings file ignored by Git.
$file = $site_dir . '/' . "env.settings.php";
if (is_file($file)) {
include $file;
// This variable should be set inside "env.settings.php" file.
return $ENVIRONMENT;
}
}
elseif ($method = 'acquia') {
if (isset($_ENV['AH_SITE_ENVIRONMENT'])) {
return $_ENV['AH_SITE_ENVIRONMENT'];
}
else {
return 'local';
}
}
// TODO: Add Acquia env get method here.
}