-
-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Version: 3.2.4
Bug Description
Array replacing operator ! in neon config does not work when the array is referenced static parameter.
My use-case is that some of my ENV variables are json encoded arrays (list of servers for example) and I'm adding them as static parameters because some extensions doesn't like ::getenv(). Regular definition works, but I need to be sure the values are not merged. In this case I'm getting following error, because in this stage NeonAdapter::process gets not yet replaced string value %env.ARRAY%
Steps To Reproduce
$configurator = new Configurator();
$configurator->addStaticParameters([
'env' => [
'ARRAY' => ['foo', 'bar'],
],
]);parameters:
foo: %env.ARRAY% # <-- it works
bar!: %env.ARRAY% # <-- it doesn't workthrows Nette\DI\InvalidConfigurationException Replacing operator is available only for arrays, item 'bar!' is not array (used in '/.../config.local.neon')
Expected Behavior
bar with operator ! preventing array merge (replacing operator) should work.
Possible Solution
Maybe introduce here simple condition to not check if value is array when it is starting with % ?