How to create custom config file?
- kevin.waterson@gmail.com
- Member | 81
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
- Marek Bartoš
- Nette Blogger | 1261
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)
- kevin.waterson@gmail.com
- Member | 81
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;
}
?>
- Marek Bartoš
- Nette Blogger | 1261
I would add each of them manually, but you can use finder to find your config files.
- Wongani
- Member | 1
Some system administrators prefer to store sensitive settings in files outside the project directory. This default site structure was chosen for its simplicity – one file per package and environment. But like any other feature, you can customize it to better suit your needs. You can choose one of them or even create your own way of organizing files.