Skip to content

Instantly share code, notes, and snippets.

@joshkoenig
Created December 22, 2011 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshkoenig/1511695 to your computer and use it in GitHub Desktop.
Save joshkoenig/1511695 to your computer and use it in GitHub Desktop.
Snippit to parse Pantheon environment config
<?php
// Place this in settings.php if you need to load Pantheon config earlier.
// For instance, when using the domain access module.
global $is_https;
$is_https = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
// Load environmental config, if present.
if (isset($_SERVER['PRESSFLOW_SETTINGS'])) {
$pressflow_settings = json_decode($_SERVER['PRESSFLOW_SETTINGS'], TRUE);
foreach ($pressflow_settings as $key => $value) {
// One level of depth should be enough for $conf and $database.
if ($key == 'conf') {
foreach($value as $conf_key => $conf_value) {
$conf[$conf_key] = $conf_value;
}
}
else {
$$key = $value;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment