Open flo-at opened 1 year ago
I would love this. It would allow me to place config files per service in their own ansible roles I use for deployment.
@antedebaas Can you give an example on how you would like to split the config into multiple files? It doesn't need to have correct syntax or anything but just show which parts would go into which files.
There are two implenentations I'm thinking about for this feature.
This is 1 of 2 tickets left in the v1.0 release plan so I'd really like to see this done.
i think the 2nd makes more sense. i had a httpd style in mind where the main file can tell to include other files in the httpd case i've included /etc/httpd/conf.virtual.d/* i can then put all config files in that dir and reload the config to apply it.
The httpd include-style does not work well for TOML files but there's still the option to specify a directory instead of a single TOML file and loading all files from that directory. That's probably the way to go here. I also prefer option 2 from above. It's on my todo list and there should be some free time in october to get this done.
The way serde works makes it a bit difficult to parse multiple files at the same time. Parsing them one after another requires some parts of the validation that serde currently handles to be reimplemented in MinMon which I would like to avoid. It seems the best solution (in terms of avoiding code duplication and simple implementation) would be to parse the concatenation of all config files and mention the line offsets of a file when an error occurs. Adjusting the line numbers in the error message isn't an option unfortunately.
I'll finish the implementation soon, there's not much left to be done.
It would be good to have the option to use a config directory as an alternative to the single config file. See #20