Closed loganasherjones closed 6 years ago
Okay, I think I've settled on the following:
def handle_config_change(old_config, new_config):
#TODO: Handle config change
pass
spec.add_source('label', 'json', filename='/path/to/json')
spec.spawn_watcher('label', target=handle_config_change)
In addition, you should be able to specify targets for individual config items:
def handle_foo_change(old_foo, new_foo):
# TODO: Handle foo change
pass
spec = YapconfSpec({'foo': {'watch_target': handle_foo_change}})
spec.add_source('label', 'json', filename='/path/to/json')
spec.spawn_watcher('label')
It would be nice to be able to list a particular item as a 'watched' item. We would be constantly watching for changes to that item via some source. I need to flesh this out a little bit more, but something like this:
Or possibly something like
That way you could specify which configs you want to watch.