-
Notifications
You must be signed in to change notification settings - Fork 228
/
wp-config-pantheon.php
110 lines (97 loc) · 3.91 KB
/
wp-config-pantheon.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
/**
* Pantheon platform settings.
*
* IMPORTANT NOTE:
* Do not modify this file. This file is maintained by Pantheon.
*
* Site-specific modifications belong in wp-config.php, not this file. This
* file may change in future releases and modifications would cause conflicts
* when attempting to apply upstream updates.
*/
// ** MySQL settings - included in the Pantheon Environment ** //
/** The name of the database for WordPress */
define('DB_NAME', $_ENV['DB_NAME']);
/** MySQL database username */
define('DB_USER', $_ENV['DB_USER']);
/** MySQL database password */
define('DB_PASSWORD', $_ENV['DB_PASSWORD']);
/** MySQL hostname; on Pantheon this includes a specific port number. */
define('DB_HOST', $_ENV['DB_HOST'] . ':' . $_ENV['DB_PORT']);
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8mb4');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
/**#@+
* Authentication Unique Keys and Salts.
*
* Changing these will force all users to have to log in again.
* Pantheon sets these values for you. If you want to shuffle them you could
* use terminus env:rotate-random-seed command:
* https://docs.pantheon.io/terminus/commands/env-rotate-random-seed
*
* @since 2.6.0
*/
define('AUTH_KEY', $_ENV['AUTH_KEY']);
define('SECURE_AUTH_KEY', $_ENV['SECURE_AUTH_KEY']);
define('LOGGED_IN_KEY', $_ENV['LOGGED_IN_KEY']);
define('NONCE_KEY', $_ENV['NONCE_KEY']);
define('AUTH_SALT', $_ENV['AUTH_SALT']);
define('SECURE_AUTH_SALT', $_ENV['SECURE_AUTH_SALT']);
define('LOGGED_IN_SALT', $_ENV['LOGGED_IN_SALT']);
define('NONCE_SALT', $_ENV['NONCE_SALT']);
/**#@-*/
/** A couple extra tweaks to help things run well on Pantheon. **/
if (isset($_SERVER['HTTP_HOST'])) {
// HTTP is still the default scheme for now.
$scheme = 'http';
// If we have detected that the end use is HTTPS, make sure we pass that
// through here, so <img> tags and the like don't generate mixed-mode
// content warnings.
if (isset($_SERVER['HTTP_USER_AGENT_HTTPS']) && $_SERVER['HTTP_USER_AGENT_HTTPS'] == 'ON') {
$scheme = 'https';
$_SERVER['HTTPS'] = 'on';
}
define('WP_HOME', $scheme . '://' . $_SERVER['HTTP_HOST']);
define('WP_SITEURL', $scheme . '://' . $_SERVER['HTTP_HOST']);
}
// Don't show deprecations; useful under PHP 5.5
error_reporting(E_ALL ^ E_DEPRECATED);
/** Define appropriate location for default tmp directory on Pantheon */
define('WP_TEMP_DIR', sys_get_temp_dir());
// FS writes aren't permitted in test or live, so we should let WordPress know to disable relevant UI
if (in_array($_ENV['PANTHEON_ENVIRONMENT'], array( 'test', 'live' )) && ! defined('DISALLOW_FILE_MODS')) {
define('DISALLOW_FILE_MODS', true);
}
/**
* Set WP_ENVIRONMENT_TYPE according to the Pantheon Environment
*/
if (getenv('WP_ENVIRONMENT_TYPE') === false) {
switch ($_ENV['PANTHEON_ENVIRONMENT']) {
case 'live':
putenv('WP_ENVIRONMENT_TYPE=production');
break;
case 'test':
putenv('WP_ENVIRONMENT_TYPE=staging');
break;
default:
putenv('WP_ENVIRONMENT_TYPE=development');
break;
}
}
/**
* Defaults you may override
*
* To override, define your constant in your wp-config.php before wp-config-pantheon.php is required.
*/
if ( ! defined('PANTHEON_HOSTNAME' ) ) {
$site_name = $_ENV['PANTHEON_SITE_NAME'];
$hostname = isset( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : $_ENV['PANTHEON_ENVIRONMENT'] . "-{$site_name}.pantheonsite.io" ;
$hostname = isset( $_ENV['LANDO'] ) ? "{$site_name}.lndo.site" : $hostname;
define( 'PANTHEON_HOSTNAME', $hostname );
}
/** Disable wp-cron.php from running on every page load and rely on Pantheon to run cron via wp-cli */
$network = isset($_ENV["FRAMEWORK"]) && $_ENV["FRAMEWORK"] === "wordpress_network";
if ( ! defined( 'DISABLE_WP_CRON' ) && $network === false) {
define( 'DISABLE_WP_CRON', true );
}