nuts-foundation / nuts-node

The reference implementation of the Nuts specification. A decentralized identity network based on the w3c ssi concepts with practical functionality for the healthcare domain.
https://nuts-foundation.gitbook.io
GNU General Public License v3.0
25 stars 16 forks source link

Clearer distinction between New, Configure and Start #2299

Open woutslakhorst opened 1 year ago

woutslakhorst commented 1 year ago

We could homogenise New by passing a single *ServiceRegistry which points to all engines/services. New only fills structs and returns a pointer which is then added to the registry. After all New methods have been called. Configure is called which opens DB connections, reads files and does consistency checks. Then Start opens sockets, starts publishers and starts go routines.

By using *ServiceRegistry, New can also create sub-services that are now created in Configure.

woutslakhorst commented 1 year ago

Success of this refactor should be visible by the reduction of lines of code.