-
-
Notifications
You must be signed in to change notification settings - Fork 8
💥 Introduce fluent config API #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Hello @retlehs , I noticed two errors in this code. /**
* Development settings
*/
->when($config->get('WP_ENV') === 'development', function($config) {
$config->env('WP_DEBUG_LOG', true)->set([
'SAVEQUERIES' => true,
'WP_DEBUG', true,
'WP_DEBUG_DISPLAY', true,
'WP_DISABLE_FATAL_ERROR_HANDLER', true,
'SCRIPT_DEBUG', true,
'DISALLOW_INDEXING', true,
'DISALLOW_FILE_MODS', false,
]);
})replace by : /**
* Development settings
*/
->when($config->get('WP_ENV') === 'development', function($config) {
$config->env('WP_DEBUG_LOG', true)->set([
'SAVEQUERIES' => true,
'WP_DEBUG' => true,
'WP_DEBUG_DISPLAY' => true,
'WP_DISABLE_FATAL_ERROR_HANDLER '=> true,
'SCRIPT_DEBUG' => true,
'DISALLOW_INDEXING' => true,
'DISALLOW_FILE_MODS' => false,
]);
})The second may be a misunderstanding or a bug, but if I want to set a default value in my configuration that can be modified via the .env file, such as WP_MEMORY_LIMIT Lines 97 to 102 in 4fec115
I will add the following to my configuration file: But if I need to modify this value in an environment, I would add the following to my .env file: But in its current state, this value will never be read. WP_MEMORY_LIMIT will be NULL from the start. |
|
I have identified and proposed a correction regarding the normal operation of the $config->env() method |
Replace the static Config class with a new fluent API for wp-config v2. This new API provides a more expressive and maintainable way to manage WordPress configuration while maintaining the same strong safety guarantees of v1.
Key changes:
when()helper for conditional configurationenv()helper for setting environment variables as constantsBreaking changes:
New config file example