Skip to content

Expand usage of Craft::parseBooleanEnv() to general.php #10319

Closed Answered by brandonkelly
aaronbushnell asked this question in Ideas
Discussion options

You must be logged in to vote

This was a tricky one! config/general.php needs to be loaded before Craft.php (where the Craft class is defined) because we need to know whether Dev Mode should be enabled before loading Craft/Yii, so we can declare the YII_DEBUG constant based on it. Otherwise, Yii will declare the YII_DEBUG constant for us, setting it to false, and the devMode config value will have no effect.

So… just worked around this by moving parseEnv() and parseBooleanEnv() over to craft\helpers\App for the next release, where they can be called before Craft/Yii is loaded:

use craft\helpers\App;

return [
  '*' => [
    'devMode' => App::parseBooleanEnv('$DEV_MODE'),
  ],
];

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@aaronbushnell
Comment options

@brandonkelly
Comment options

Answer selected by brandonkelly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants