nette / bootstrap

🅱 The simple way to configure and bootstrap your Nette application.
https://doc.nette.org/bootstrap
Other
668 stars 36 forks source link

Configurator: Turn on debug mode if NETTE_DEBUG env is present #53

Closed foxycode closed 7 years ago

foxycode commented 7 years ago

I am using ENV variable to enable debug mode. It have many advantages: https://pehapkari.cz/blog/2017/01/23/inteligentni-debug-mode-v-nette/

It would be nice to have this feature directly in Nette.

TomasVotruba commented 7 years ago

Hi, thanks for sending PR!

Could you please fix coding standard - https://travis-ci.org/nette/bootstrap/jobs/194070357#L249? Thank you

foxycode commented 7 years ago

Sorry, fixed. Also created constant for variable name.

TomasVotruba commented 7 years ago

Thank you.

milo commented 7 years ago

I don't think this should be internal part of Nette.

It is easy to implement in an application:

if (getenv('MY_APP_DEBUG')) {
    $configurator->setDebugMode(TRUE);
}

The debug mode can expose sensitive information, any automatic enabling must be careful.

The environment variables are a little bit magic. No one knows where it came from. "Has it been set by HTTP server? Or has it been set before by OS?". The same for CLI. It is very hard to find who set it. It is global state.

dg commented 7 years ago

I agree with @milo that widen cases for automatic debug mode is dangerous.