My use case it the following scenario: https://symfony.com/doc/current/testing/insulating_clients.html
createClient() creates a new Kernel for every call. It reboots the kernel (between requests).
Now with the new environment variables system in symfony4, I ran into problems. My Kernel depends on an environment parameter "tenant". Because of the nature of environment variables in symfony 4.x the env variable is read everytime the kernel is booted.
So when I create new Kernels in a row, the env variable will change its value when (re)bootet.
How would I freeze the environment variables in the kernel? Or how would I overwrite the mechanism of reading the env variable from "env" at all. E.g. I want to prepare the kernels so that the env-variables in the config aren't read from real environment, but from an array saved in the instance of the kernel, etc.
Overwriting \Symfony\Component\DependencyInjection\EnvVarProcessor seems to be a good trick, but this service is created and cached on container compiles, where would i inject my insulated env parameters?
$client->insulate() does not work either (and I don't want to use that)
Aucun commentaire:
Enregistrer un commentaire