CurtisBelt
11/12/2016 - 11:50 PM

wp-config for Re-usable Wordpress Installation

wp-config for Re-usable Wordpress Installation

<?php


	/********************************************  // <-- Add a dash to turn on debugging
		// define( 'WP_DEBUG', true );
		// define( 'WP_DEBUG_LOG', true );
		// define( 'WP_DEBUG_DISPLAY', true );
		error_reporting(E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR);
		ini_set('display_errors', 1);
		// define( 'SCRIPT_DEBUG', true );
		// define( 'TRIBUS_DEV', true );
	/********************************************/

	$default_theme_mapping = array(
		'remax'        => 'remax-results',
		'village'      => 'village',
		'groundwork'   => 'tribus-groundwork',
	);

	$tld = "host";

	$table_prefix  = 'wp_'; // Wordpress variable

	define( 'JETPACK_DEV_DEBUG', true );
	define( 'KINT_TO_DEBUG_BAR', false );


/*********************************************************/


/**
 * - Determine which install to use, based on domain name or environment variable when in CLI
 * - Set default theme if not in CLI
 */

if ( php_sapi_name() !== 'cli' )  {
	preg_match_all( '/(?<=\.|)\w+\.\w+$/', $_SERVER[ 'HTTP_HOST' ], $config_domain_name);
	$domain_name = str_replace( '.' . $tld, '', $config_domain_name[0][0] );
	define( 'WP_DEFAULT_THEME', isset( $default_theme_mapping[ $domain_name ] ) ? $default_theme_mapping[ $domain_name ] : 'twentyseventeen');
} else {
	// Probably using WP-CLI
	// Let's use an abritrarily made up environment variable called WP_HOST instead, so we can still control which database we're on when in the command line.
	// TODO: Will need to document enabling ENV variables in php.ini when releasing this publicly
	$domain_name = getenv( 'WP_HOST' );
	if ( empty( $domain_name ) ) {
		die( "[wp-config.php] ERROR: WP_HOST not set. Please run \"export WP_HOST=%domain_name%\" to control a specific install.\n" );
	}
}

define( 'UPLOADS', 'wp-content/uploads/' . $domain_name );


/** Standard WP Constants */
define( 'DB_NAME',          'wordpress_' . $domain_name );
define( 'DB_USER',          'root' );
define( 'DB_PASSWORD',      'root' );
define( 'DB_HOST',          'localhost' );
define( 'DB_CHARSET',       'utf8mb4' );
define( 'DB_COLLATE',       'utf8mb4_unicode_ci' );
define( 'AUTH_KEY',         'e}|O|nGe(Fp<dEB ]Tu%8-*yB&lf7nUjE aX+;5jB^AF=%W<d)q%.Z:SeiTU?-UE');
define( 'SECURE_AUTH_KEY',  'R7&OGU-r``q[{r::M9%#1+)Kfdt-3%|)+^641OYRaq^OFz/[NlpWXoy!-Eg&x9F5');
define( 'LOGGED_IN_KEY',    '!*T)f$Raq/HEHGMxF3wGWGxjKZ`4P2AVS-mD02??HdWHJH,UFY%U]z1h4]/wrZi!');
define( 'NONCE_KEY',        'BjYtul>mBy#@||&:*UcM-2L;KK*k>2d&fL*5:anwI4NjFjyJ-D<JBO<ISbG2QKar');
define( 'AUTH_SALT',        'Hi7c%Du6vU.o}lI![4*o`yPe76:U`z3vL.<_%(($eZa^[4//,k1_3M{e=26[7g&o');
define( 'SECURE_AUTH_SALT', '?H`*44N CA0}z|RB$b)u]eY~?ba5r&]2$2`G9k*+H*V#_FJ`|yUN-6ftrK@SnRX+');
define( 'LOGGED_IN_SALT',   '$q5$utv7 GpYOuz3]oIqz$PwUG.m})5+e!QT^|6oyj*3[?+6+LmL+k?P-6wc8!_L');
define( 'NONCE_SALT',       'x[?o7zS$i0<(5KEf-gF+A6eZ6-1E%DB30vuws7HTYH58o<]Y.`7):gd;U)~ jPm8');


/** Enables/Configures Multisite */
define( 'WP_ALLOW_MULTISITE', true );
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', true );
define( 'DOMAIN_CURRENT_SITE', $domain_name . '.' . $tld );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );


define( 'WP_CACHE_KEY_SALT', $domain_name );
$redis_server = array(
	'host'     => '127.0.0.1',
	'port'     => 6379,
	// 'auth'     => '',
	// 'database' => 0, // Optionally use a specific numeric Redis database. Default is 0.
);


/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH') )
	define( 'ABSPATH', dirname(__FILE__) . '/' );

/** Sets up WordPress vars and included files. */
require_once( ABSPATH . 'wp-settings.php' );