-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathwp-config.php
More file actions
181 lines (158 loc) · 4.13 KB
/
wp-config.php
File metadata and controls
181 lines (158 loc) · 4.13 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?php
require_once __DIR__ . "/vendor/autoload.php";
/**
* Check if named .env.{$environment} exists
*
* @return {String} $environment
*/
$environment = function() {
$stages = array(
"development",
"staging",
"production"
);
foreach ( $stages as $stage ) {
if ( file_exists(__DIR__ . "/.env.{$stage}") ) {
return $stage;
}
}
return false;
};
/**
* Use Dotenv to set stage. Fall back to non-suffixed .env if a
* named stage was not found.
*/
try {
if ( $stage = $environment() ) {
Dotenv::load(__DIR__, ".env.{$stage}");
} else {
Dotenv::load(__DIR__);
}
} catch (Exception $e) {
// Continue to see if required ENV variables are set another way...
}
try {
Dotenv::required(array(
"DB_NAME",
"DB_USER",
"DB_PASSWORD",
"DB_HOST",
"WP_HOME",
"WP_SITEURL"
));
} catch (Exception $e) {
echo $e->getMessage();
die;
}
/**
* Stage
*/
define("WP_ENV", getenv("WP_ENV") ?: "development");
/**
* Database
*/
define("DB_NAME", getenv("DB_NAME"));
define("DB_USER", getenv("DB_USER"));
define("DB_PASSWORD", getenv("DB_PASSWORD"));
define("DB_HOST", getenv("DB_HOST"));
/**
* Debug
*
* This filters the WP_DEBUG declaration from .env.{stage} to a
* boolean. Accepts strings like 'true', 'yes', etc.
*
* @see http://php.net/manual/en/function.filter-var.php
*/
define("WP_DEBUG", filter_var(getenv("WP_DEBUG"), FILTER_VALIDATE_BOOLEAN));
/**
* Cache
*
* This filters the WP_CACHE declaration from .env.{stage} to a
* boolean. Accepts strings like 'true', 'yes', etc.
*
* @see http://php.net/manual/en/function.filter-var.php
*/
define("WP_CACHE", filter_var(getenv("WP_CACHE"), FILTER_VALIDATE_BOOLEAN));
/**
* Mailcatcher
*
* This filters the WP_MAILCATCHER declaration from .env.{stage} to a
* boolean. Accepts strings like 'true', 'yes', etc.
*
* @see https://wordpress.org/plugins/mailcatcher/
*/
if ( WP_ENV === "development" ) {
define("WP_MAILCATCHER", filter_var(getenv("WP_MAILCATCHER"), FILTER_VALIDATE_BOOLEAN));
}
/**
* URLs
*/
define("WP_HOME", getenv("WP_HOME"));
define("WP_SITEURL", getenv("WP_SITEURL"));
/**
* Authentication Unique Keys and Salts
*/
define("AUTH_KEY", getenv("AUTH_KEY") ?: "");
define("SECURE_AUTH_KEY", getenv("SECURE_AUTH_KEY") ?: "");
define("LOGGED_IN_KEY", getenv("LOGGED_IN_KEY") ?: "");
define("NONCE_KEY", getenv("NONCE_KEY") ?: "");
define("AUTH_SALT", getenv("AUTH_SALT") ?: "");
define("SECURE_AUTH_SALT", getenv("SECURE_AUTH_SALT") ?: "");
define("LOGGED_IN_SALT", getenv("LOGGED_IN_SALT") ?: "");
define("NONCE_SALT", getenv("NONCE_SALT") ?: "");
/**
* 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", "");
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each a unique
* prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = getenv("DB_TABLE_PREFIX") ?: "wp_";
/**
* WordPress Localized Language, defaults to English.
*
* Change this to localize WordPress. A corresponding MO file for the chosen
* language must be installed to wp-content/languages. For example, install
* de_DE.mo to wp-content/languages and set WPLANG to "de_DE" to enable German
* language support.
*/
define("WPLANG", getenv("WP_LANG") ?: "");
/**
* Custom content directory
*/
define("CONTENT_DIR", "/app");
define("WP_CONTENT_DIR", __DIR__ . CONTENT_DIR);
define("WP_CONTENT_URL", WP_HOME . CONTENT_DIR);
/**
* Must-use plugins directory
*/
define("WPMU_PLUGIN_DIR", WP_CONTENT_DIR . "/mu-plugins");
define("WPMU_PLUGIN_URL", WP_CONTENT_URL . "/mu-plugins");
/**
* Custom language directory
*
* @link http://svn.automattic.com/wordpress-i18n/
* @link http://languages.koodimonni.fi/
*/
define("WP_LANG_DIR", WP_CONTENT_DIR . "/lang");
/**
* Other settings
*/
define("WP_DEFAULT_THEME", "sprout");
define("DISALLOW_FILE_EDIT", true);
define("DISALLOW_FILE_MODS", true);
define("DISABLE_WP_CRON", true);
/**
* Absolute path to WP
*/
if ( ! defined("ABSPATH") ) {
define("ABSPATH", __DIR__ . "/wp/");
}
require_once ABSPATH . "wp-settings.php";