Open igorsantos07 opened 6 years ago
Yes it's easy to overlook clearing of the config cache.
However, when should env()
"know" that something's "wrong", vs when values are expected to be empty or not defined at all?
env()
could throw an exception if it's called while the configuration is cached:
if (app()->configurationIsCached()) {
throw new FooException('...');
}
It's easy to overlook the mention about config caching on the documentation, and then start digging around on why your
env()
calls are weirdly empty in production, while the rest of the application seems to be working fine:It's bad to have different behavior happening on the application that can only be explained by digging the docs, especially with something seldom-used as config/env vars - and that's not mentioned in the function description either.
My suggestion is to make
env()
issue a warning log explaining "you're probably doing something wrong".