Fork me on GitHub
#graphql
<
2018-01-07
>
timgilbert00:01:00

Say, I feel like I may have asked this before, but my google-fu is failing me. I’m trying to figure out how to use (inject-app-context-interceptor) in lacinia-pedestal to add a db connection into my app-context where the resolvers can get to it. I’m starting from the sample code from the README.md, and I have no idea where I should place the call to (inject-app-context-interceptor).

timgilbert00:01:05

I tried including it in the :interceptors option to (lacinia/service-map) but got a an assertion failure Assert failed: (some? interceptor) at com.walmartlabs.lacinia.pedestal.interceptors:7

timgilbert00:01:08

I guess I don’t understand what the API is between (service-map) and (inject-interceptor)

timgilbert00:01:54

Aha! It seems like I just needed to pass my context as the :app-context option key to (service-map)

hlship20:01:34

The options supported by service-map are documented but scattered about across a couple of functions it calls; they should be organized together, even if there ends up being some repetition.

hlship20:01:02

Or at the very least "... and additional options passed to function gnip-gnop"

timgilbert21:01:57

I sent a PR to at least add that one option to the (service-map) docstring, since that’s what tripped me up specifically.