1
1
<?php
2
2
/**
3
- * This file is generated by WP Starter Package , and contains base configurations of the WordPress.
3
+ * This file is generated by WP Starter package , and contains base configuration of the WordPress.
4
4
*
5
- * All the configuration constants used by WordPress are set via .env file .
5
+ * All the configuration constants used by WordPress are set via environment variables .
6
6
* Default settings are provided in this file for most common settings, however database settings
7
7
* are required, you can get them from your web host.
8
+ *
8
9
* A sample .env file (.env.example) should be placed in the root of your project, rename it to .env
9
10
* and edit it according to your needs.
10
11
*/
@@ -17,13 +18,13 @@ require_once realpath({{{VENDOR_PATH}}}.'/autoload.php');
17
18
/**
18
19
* Configuration constants.
19
20
*
20
- * Use .env file to set WordPress constants.
21
+ * Use environment variables to set WordPress constants.
21
22
* Mandatory settings:
22
23
* - DB_NAME
23
24
* - DB_USER
24
25
* - DB_PASSWORD
25
26
*
26
- * @var array $env All the variables stored in .env file
27
+ * @var array $env All the variables stored in environment variables
27
28
*/
28
29
$env = WCM\WPStarter\Helpers::settings({{{ENV_REL_PATH}}}, '{{{ENV_FILE_NAME}}}');
29
30
array_walk($env, function ($value, $name) {
@@ -54,24 +55,21 @@ if (! isset($table_prefix) || empty($table_prefix)) {
54
55
}
55
56
56
57
/**
57
- * Set unique authentication keys if not already set via .env file.
58
- * If available, environment name is mixed to keys so they become unique per environment.
58
+ * Set unique authentication keys if not already set via environment variables.
59
59
*/
60
- $environment = getenv('WORDPRESS_ENV');
61
- $pre = $environment ? substr($environment, 0, 5) : substr('{{{AUTH_KEY}}}', 0, 5);
62
- $post = $environment ? substr($environment, -5, 5) : substr('{{{SECURE_AUTH_KEY}}}', 0, 5);
63
- defined('AUTH_KEY') or define('AUTH_KEY', $pre.'{{{AUTH_KEY}}}'.$post);
64
- defined('SECURE_AUTH_KEY') or define('SECURE_AUTH_KEY', $pre.'{{{SECURE_AUTH_KEY}}}'.$post);
65
- defined('LOGGED_IN_KEY') or define('LOGGED_IN_KEY', $pre.'{{{LOGGED_IN_KEY}}}'.$post);
66
- defined('NONCE_KEY') or define('NONCE_KEY', $pre.'{{{NONCE_KEY}}}'.$post);
67
- defined('AUTH_SALT') or define('AUTH_SALT', $pre.'{{{AUTH_SALT}}}'.$post);
68
- defined('SECURE_AUTH_SALT') or define('SECURE_AUTH_SALT', $pre.'{{{SECURE_AUTH_SALT}}}'.$post);
69
- defined('LOGGED_IN_SALT') or define('LOGGED_IN_SALT', $pre.'{{{LOGGED_IN_SALT}}}'.$post);
70
- defined('NONCE_SALT') or define('NONCE_SALT', $pre.'{{{NONCE_SALT}}}'.$post);
60
+ defined('AUTH_KEY') or define('AUTH_KEY', '{{{AUTH_KEY}}}');
61
+ defined('SECURE_AUTH_KEY') or define('SECURE_AUTH_KEY', '{{{SECURE_AUTH_KEY}}}');
62
+ defined('LOGGED_IN_KEY') or define('LOGGED_IN_KEY', '{{{LOGGED_IN_KEY}}}');
63
+ defined('NONCE_KEY') or define('NONCE_KEY', '{{{NONCE_KEY}}}');
64
+ defined('AUTH_SALT') or define('AUTH_SALT', '{{{AUTH_SALT}}}');
65
+ defined('SECURE_AUTH_SALT') or define('SECURE_AUTH_SALT', '{{{SECURE_AUTH_SALT}}}');
66
+ defined('LOGGED_IN_SALT') or define('LOGGED_IN_SALT', '{{{LOGGED_IN_SALT}}}');
67
+ defined('NONCE_SALT') or define('NONCE_SALT', '{{{NONCE_SALT}}}');
71
68
72
69
/**
73
70
* Environment-aware settings. Be creative, but avoid to set sensitive settings here.
74
71
*/
72
+ $environment = getenv('WORDPRESS_ENV');
75
73
switch ($environment) {
76
74
77
75
case 'development':
112
110
}
113
111
114
112
/**
115
- * Set WordPress paths and urls if not set via .env file .
113
+ * Set WordPress paths and urls if not set via environment variables .
116
114
*/
117
115
if (! defined('WP_HOME')) {
118
116
$server = filter_input_array(INPUT_SERVER, array(
@@ -133,7 +131,7 @@ defined('WP_CONTENT_URL') or define('WP_CONTENT_URL', rtrim(WP_HOME, '/').'/{{{W
133
131
/**
134
132
* Clean up.
135
133
*/
136
- unset($env, $environment, $pre, $post, $ server, $secure, $scheme, $name);
134
+ unset($env, $environment, $server, $secure, $scheme, $name);
137
135
138
136
/**
139
137
* Allows to load MU plugins in subfolders.
0 commit comments