Closed
Description
Description
Inspired by this: #25693
I understand that your application should not be aware of where your configuration come from. However at some point you had to configure it using env variables.
What I was thinking is being able to access env Variables through the container when it is booted.
Sometimes we need to configure a static property of a non service class that will depend on the OS (it might be because of bad design or whatever but still it happens).
Example
// ./src/Kernel.php
public function boot()
{
parent::boot();
// NOT WORKING AS IT RETURNS THE DEFAULT VALUE
MyClass::$staticProperty = $this->getContainer()->getParameter('env(MY_ENV_VARIABLE)');
}
would be nice if we had something like
// ./src/Kernel.php
public function boot()
{
parent::boot();
// PROTECTED PROPERTY AS OF TODAY
MyClass::$staticProperty = $this->getContainer()->getEnv('MY_ENV_VARIABLE');
}
or event just resolve env in the getParameter
method.
I don't know if the need is clear enough. Please do not hesitate to tell me otherwise.
WDYT ?