I am trying to make the health configuration of the excellent netdata service easy. I parse all the default config files and convert them to an attrset, and then I generate a new config file from the attrset.
I would like to simply add attributes to the attrset, but also change the defaults.
How can I make it so that services.netdata.health is an attrset with the defaults and it can be altered, e.g. setting services.netdata.health.disk_space_usage.enabled = false?
a set of default settings applied to all hosts, and
host specific settings that override/add to the defaults
The netdata module only has a single set so that means you have to keep that somewhere. You could of course do this by having a helper function that reads stuff from a file when you assign to the settings for that given host or split up the existing settings into defaultSettings and settings or something like that.
I personally think that’s a bad idea. The cleanest option is to extend the module system - your case is not going to be general anyway.
The problem right now is that the netdata health configuration is hard to configure, and with the system I have now you can easily add a typechecked configuration, and override the configurations that are there.
So I’m not configuring anything for me, I’m making it easy for everyone. I’ll make a PR soon.