Created
December 22, 2011 20:18
-
-
Save joshkoenig/1511695 to your computer and use it in GitHub Desktop.
Snippit to parse Pantheon environment config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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