danidiaz / counter

overengineered REST server which provides counters

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rework how Knobs are handled

danidiaz opened this issue · comments

Knobs are controls associated to some components which allow controlling the component from an HTTP endpoint, kind of like what the "actuator" framework does for Spring Boot.

Right now, if we want to add a component with a Knob, we have to register it in two places: in the main composition root, and in the Servant "runner" component.

This is annoying, it would be better to specify it in only one place. A further annoyance is that we need to add two coomponents to the composition root: the component-with-knob and the bare component.

The following solution is implemented in c9ce51a:

With these changes, we don't need to update in two places whenever we add a component accompanied by a Knob. It's enough to update the composition root!