-
- Notifications
You must be signed in to change notification settings - Fork 74
Closed
Description
Version: 3.1.2
Bug Description
The documentation says (https://doc.nette.org/en/application/bootstrap#toc-dynamic-parameters):
We can also add dynamic parameters to the container, their different values, unlike static parameters, will not cause the generation of new DI containers. Environment variables could be easily made available using dynamic parameters. We can access them via
%env.variable%in configuration files.
When I try this in practice, the parameter value is null instead of the expected value of expanded env variable.
Steps To Reproduce
I created a minimal project that shows this problem: https://github.com/ondrejmirtes/nette-di-dynamic
The script test.php:
<?php require_once __DIR__ . '/vendor/autoload.php'; $configurator = new Nette\Bootstrap\Configurator; $configurator->setTempDirectory(__DIR__ . '/temp'); $configurator->addConfig(__DIR__ . '/test.neon'); $configurator->addDynamicParameters([ 'env' => getenv(), ]); $container = $configurator->createContainer(); var_dump($container->parameters['test']);The neon file test.neon:
parameters: test: %env.NETTE_TEST%/fooHow to run:
export NETTE_TEST=foo php test.php Expected Behavior
string(7) "foo/foo" Actual Behaviour
NULL eydun
Metadata
Metadata
Assignees
Labels
No labels