haraka / haraka-config

Haraka config file loader and parser
https://www.npmjs.com/package/haraka-config
MIT License
10 stars 13 forks source link

Add option to load main config in the beginning #68

Closed felixauringer closed 4 months ago

felixauringer commented 1 year ago

The README mentions that it is possible to have one JSON / YAML file containing the configuration for different files. I really like that because Haraka uses many different configuration files.

However, I think (if I understood the code correctly) that the config loader can only use cached results from such a file if it has been loaded before. But I didn't find any option to load an additional config file on startup (of course it's possible via a plugin). So the only possibility of using the feature mentioned above I could find is to abuse a JSON / YAML config file that is loaded and include other configuration files in it (using the ! syntax). Additionally, I am not sure if there even are any JSON / YAML files that are loaded on startup by default and there always has to be a smtp.* (otherwise Haraka terminates), so that file can not be replaced easily

So it's really hacky to use the ! syntax to keep all configuration options in one main config file. Maybe a possible solution could be to load a main configuration file (e.g. main.json or main.yaml) on startup if present so all other configuration files can theoretically be defined there with the ! syntax if somebody prefers to do so.