How to add %appDir% like parameter to “includes” section of config.neon?

Tomáš Votruba
Moderator | 1114
+
0
-

I load config with Nette\DI\Config\Loader, which also covers includes.

$neonLoader = new Nette\DI\Config\Loader;
$neonLoader->load(__DIR__ . '/vendor/another-package/custom.neon');

I have a config that can be in monorepo and dependency = 2 different locations.

It uses .neon relative path, that works for only 1 location:

includes:
	- vendor/package/ecs/psr2.neon

In other location, it tries to load vendor/another-packages/vendor/package/ecs/psr2.neon.

This could be fixed by using variable like:

includes:
	- %getCwd%/vendor/package/ecs/psr2.neon

But how to achieve that, since Nette\DI\Config\Loader->load() only accepts files?

Or any other ideas how to achieve this? Thank you


Something like %kernel.project_dir% in Symfony Kernel

Last edited by Tomáš Votruba (2018-01-22 21:41)