Skip to content

Instantly share code, notes, and snippets.

@robertcedwards
Created July 19, 2012 18:18
Show Gist options
  • Save robertcedwards/3145787 to your computer and use it in GitHub Desktop.
Save robertcedwards/3145787 to your computer and use it in GitHub Desktop.
Hardened, cleaned up wp-config.php file for use with environmental variables
<?php
/** @package WordPress */
if ( file_exists( dirname( __FILE__ ) . '/local.php' ) ) {
include( dirname( __FILE__ ) . '/local.php' );
define( 'WP_LOCAL_DEV', true ); // We'll talk about this later
} else {
/** Hardened database loop */
$dbvalues = array('DB_HOST', 'DB_NAME', 'DB_USER', 'DB_PASSWORD');
/** -------------------------------------------------------------*/
foreach ($dbvalues as $dbvalue) {define($dbvalue, getenv($dbvalue));}
/** -------------------------------------------------------------*/
/** Hardened Salty Key loop*/
$saltykeys = array('AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY', 'AUTH_SALT', 'SECURE_AUTH_SALT' , 'LOGGED_IN_SALT', 'NONCE_SALT' );
/** -------------------------------------------------------------*/
foreach ($saltykeys as $saltykey) {define($saltykey, getenv($saltykey));}
/** -------------------------------------------------------------*/
}
/** the rest */
$table_prefix = 'wp_';
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
define('WPLANG', '');
define('WP_DEBUG', false);
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** -------------------------------------------------------------*/
/* PHPFOG edit to patch a few issues of file saves, plugins, caching for Varnish */
define('FS_METHOD', 'direct');
define('WP_CACHE' , true);
require_once(ABSPATH . 'wp-settings.php');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment