--- civicrm.settings.php.tpl.orig	2012-11-05 20:57:32.000000000 -0700
+++ civicrm.settings.php.tpl	2013-05-22 09:29:25.000000000 -0600
@@ -52,6 +52,43 @@
  */
 define( 'CIVICRM_UF'               , '%%cms%%'        );
 
+ /**
+ * Pantheon Systems:
+ *
+ * Repopulate needed variables based on the Pantheon environment if applicable.
+ * http://www.kalamuna.com/news/civicrm-pantheon
+ *
+ */
+if (!empty($_SERVER['PRESSFLOW_SETTINGS'])) {
+  $env = json_decode($_SERVER['PRESSFLOW_SETTINGS'], TRUE);
+  if (!empty($env['conf']['pantheon_binding'])) {
+    $pantheon_db = $env['databases']['default']['default'];
+    $pantheon_conf = $env['conf'];
+
+    //user name and password
+    $db_string = $pantheon_db['driver'] . '://' . $pantheon_db['username'] . ':' . $pantheon_db['password'] . '@';
+    //host
+    $db_string .= 'dbserver.' . $pantheon_conf['pantheon_environment'] . '.' . $pantheon_conf['pantheon_site_uuid'] . '.drush.in' . ':' . $pantheon_db['port'];
+    // database
+    $db_string .= '/' . $pantheon_db['database'] . '?new_link=true';
+
+    // define the database strings
+    define('CIVICRM_UF_DSN', $db_string);
+    define('CIVICRM_DSN', $db_string);
+
+    // define the file paths
+    global $civicrm_root;
+
+    $civicrm_root = '/srv/bindings/' . $pantheon_conf['pantheon_binding'] . '/code/' . str_replace('drupal', '', drupal_get_path('module', 'civicrm'));
+    define('CIVICRM_TEMPLATE_COMPILEDIR', '/srv/bindings/' . $pantheon_conf['pantheon_binding'] . '/files/civicrm/templates_c/');
+
+    // Use Drupal base url and path
+    global $base_url, $base_path;
+    define('CIVICRM_UF_BASEURL', $base_url . '/');
+    define( 'CIVICRM_IDS_ENABLE', 0);
+  }
+} else {
+
 /**
  * Content Management System (CMS) Datasource:
  *
@@ -59,6 +96,9 @@
  * Datasource (DSN) format:
  *      define( 'CIVICRM_UF_DSN', 'mysql://cms_db_username:cms_db_password@db_server/cms_database?new_link=true');
  */
+
+// PANTHEON USERS - These settings are overridden above when running on Pantheon.
+// These settings are ONLY included here to remain compatible all other hosts.
 define( 'CIVICRM_UF_DSN'           , 'mysql://%%CMSdbUser%%:%%CMSdbPass%%@%%CMSdbHost%%/%%CMSdbName%%?new_link=true' );
 
 /**
@@ -80,6 +120,9 @@
  *      define( 'CIVICRM_DSN'         , 'mysql://civicrm:YOUR_PASSWORD@localhost/civicrm?new_link=true' );
  *
  */
+ 
+// PANTHEON USERS - These settings are overridden above when running on Pantheon.
+// These settings are ONLY included here to remain compatible all other hosts.
 define( 'CIVICRM_DSN'          , 'mysql://%%dbUser%%:%%dbPass%%@%%dbHost%%/%%dbName%%?new_link=true' );
 
 /**
@@ -173,7 +216,7 @@
 /*
  * If you want to disable IDS, set this to 0.
  */
-define( 'CIVICRM_IDS_ENABLE', 1);
+define( 'CIVICRM_IDS_ENABLE', 0);
 
 /**
  * Enable this constant, if you want to send your email through the smarty
@@ -260,6 +303,8 @@
 // define('CIVICRM_LANGUAGE_MAPPING_PT', 'pt_BR');
 // define('CIVICRM_LANGUAGE_MAPPING_ZH', 'zh_TW');
 
+} // end Pantheon check
+
 /**
  *
  * Do not change anything below this line. Keep as is
