-
Notifications
You must be signed in to change notification settings - Fork 52
Closed
Labels
Description
Currently the system is created through the component/system-map function:
(defn new-system [config]
(let [config (meta-merge base-config config)]
(-> (component/system-map
:app (handler-component (:app config))
:http (jetty-server (:http config))
:example (endpoint-component example-endpoint))
(component/system-using
{:http [:app]
:app [:example]}))))But instead we could define the system via a data structure:
{:components
{:app duct.component.handler/handler-component
:http ring.component.jetty/jetty-server}
:endpoints
{:example bar.endpoint.example/example-endpoint}
:dependencies
{:http [:app]
:app [:example]}}And then have a system-factory function to construct the new-system function from the data structure.
(def new-system
(system-factory (read-edn "foo/system.edn")))As well as reducing the amount of code, it would also allow generators to more easily add components and endpoints to the system.
Reactions are currently unavailable