duct

teaforthecat 2019-07-25T14:10:34.004200Z

It looks like web handlers don’t get access to the instantiated top level keys, such as a db connection. For example in:

(defmethod ig/init-key :foobar.handler/example [_ {:keys [db] :as options}]
  (context "/example" []
    (GET "/" []
      {:body {:example "data"}})))
db will be a function and not the instantiated object I’m looking for. I must be missing something, I’m not seeing how to provide the db connection to the web handler.

teaforthecat 2019-07-25T14:18:32.004900Z

(and if I call that function, I get the instantiated object)

2019-07-25T18:58:48.005300Z

What is your config.edn?

teaforthecat 2019-07-25T19:47:13.007300Z

oops, it looks like I must have been following some module code for inspiration when writing the db part - modules return functions that accept the conf, but regular components do not. sorry for the noise!

1👍
2019-07-25T21:01:20.008600Z

Basically, what you get is what you returned from ig/init-key multimethod.