How to create custom config file?

+
0
-

Is nette able to have multiple config files per module?
I have created my own modules,
eg:
BlogModule/presenters/BlogPresenter.php
BlogModule/templates/default.latte

I would like to have a custom config file with extends the current config options.
eg:
BlogModule/config/config.neon

How can this be done with nette?

Kev

Mabar
Member | 300
+
+2
-

In app/Bootstrap.php

$configurator->addConfig(__DIR__ . '/BlogModule/config/config.neon');

Each added file has higher priority than previous

In neon

includes:
  - relative/path/to/config.neon

Main file has higher priority than included files, each included file has higher priority than previous included file

Last edited by Mabar (2020-07-05 12:10)

+
0
-

Mabar wrote:

In app/Bootstrap.php

$configurator->addConfig(__DIR__ . '/BlogModule/config/config.neon');

Each added file has higher priority than previous

In neon

includes:
  - relative/path/to/config.neon

Main file has higher priority than included files, each included file has higher priority than previous included file

Thanks Mabar..
Is it possible for config to search paths for a config file, based on the module name
eg:

<?php

  $config_path = 'app/'.$module_name.'/config/config.neon';

  if( file_exists( $config_path ) ){
    include $config_path;
  }
?>
Mabar
Member | 300
+
+2
-

I would add each of them manually, but you can use finder to find your config files.