It feels like this could have been simplified to just append to the config file rather than invent a template format, but this works.