Description
Right now, env variables names that don't match preg \w
are rejected with an exception, in EnvPlaceholderParameterBag
:
if (!preg_match('/^(?:\w++:)*+\w++$/', $env)) {
throw new InvalidArgumentException(sprintf('Invalid %s name: only "word" characters are allowed.', $name));
}
But it also is documented that env system can be used to load dynamic variables, using env var processors. We had a need to allow user-driven configuration injected as services parameters, and dynamic runtime property of injecting env is exactly the right API for this.
In our case, the env var processor injects variables from database, stored in a registry-like tree (implementation is a flat key/value store but that's implementation detail) and we'd like our variables names to contain dots .
or any other char, pretty much like parameters allow, so we can hierarchize/organize dynamic configuration.
Could it be possible to drop this naming restriction ? Or is there an easy way to bypass it ?