-
-
Save timani/4505741 to your computer and use it in GitHub Desktop.
A wp-config.php file Pantheon and local development
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 | |
if (isset($_SERVER['PANTHEON_ENVIRONMENT'])) { | |
// Tweak #1 | |
// Load database settings from PRESSFLOW_SETTINGS environment variable... | |
$pressflow_settings = json_decode($_SERVER['PRESSFLOW_SETTINGS'], TRUE); | |
$database_settings = $pressflow_settings['databases']['default']['default']; | |
$wp_upload_url = "/srv/bindings/" . $pressflow_settings['conf']['pantheon_binding'] . "/files"; | |
/** MySQL configs */ | |
define('DB_NAME', $database_settings['database']); | |
define('DB_USER', $database_settings['username']); | |
define('DB_PASSWORD', $database_settings['password']); | |
define('DB_HOST', $database_settings['host'] . ":" . $database_settings['port']); | |
define('DB_CHARSET', 'utf8'); | |
define('DB_COLLATE', ''); | |
// Tweak #2 | |
// Sneak in wordpress cookies as Drupal cookies (change prefix from wordpress_ to SESS) | |
$salt = md5($_SERVER['PRESSFLOW_SETTINGS']); | |
define('USER_COOKIE', 'SESSuser' . $salt); | |
define('PASS_COOKIE', 'SESSpass' . $salt); | |
define('AUTH_COOKIE', 'SESSauth' . $salt); | |
define('SECURE_AUTH_COOKIE', 'SESSsecure' . $salt); | |
define('LOGGED_IN_COOKIE', 'SESSloggedin' . $salt); | |
define('TEST_COOKIE', 'SESStest' . $salt); | |
// Tweak #3 | |
// Other constants that need to be dynamic for pantheon */ | |
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']); | |
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']); | |
define('UPLOADS', $wp_upload_url); // @TODO Set this to be the binding path | |
} else { | |
//These setting will be used on environments other than Pantheon (ie, your localhost) | |
define('DB_NAME', 'local_db_database'); | |
/** MySQL database username */ | |
define('DB_USER', 'local_db_username'); | |
/** MySQL database password */ | |
define('DB_PASSWORD', 'local_db_password'); | |
/** MySQL hostname */ | |
define('DB_HOST', 'localhost'); | |
/** Database Charset to use in creating database tables. */ | |
define('DB_CHARSET', 'utf8'); | |
/** The Database Collate type. Don't change this if in doubt. */ | |
define('DB_COLLATE', ''); | |
} | |
// Standard wp-config.php from here on down. | |
define('AUTH_KEY', 'put your unique phrase here'); | |
define('SECURE_AUTH_KEY', 'put your unique phrase here'); | |
define('LOGGED_IN_KEY', 'put your unique phrase here'); | |
define('NONCE_KEY', 'put your unique phrase here'); | |
define('AUTH_SALT', 'put your unique phrase here'); | |
define('SECURE_AUTH_SALT', 'put your unique phrase here'); | |
define('LOGGED_IN_SALT', 'put your unique phrase here'); | |
define('NONCE_SALT', 'put your unique phrase here'); | |
$table_prefix = 'wp_'; | |
define('WPLANG', ''); | |
define('WP_DEBUG', false); | |
if (!defined('ABSPATH')) | |
define('ABSPATH', dirname(__FILE__) . '/'); | |
require_once (ABSPATH . 'wp-settings.php'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment