yada

raymcdermott 2018-11-13T15:56:32.065100Z

dumb question … where do I put the config for insert-interceptor … in routes?

borkdude 2018-11-13T16:20:33.065300Z

@raymcdermott config?

borkdude 2018-11-13T16:21:19.065800Z

@raymcdermott we have something like this:

(-> model
        ...
        yada/resource
        (insert-interceptor i/available?
                            log-charset)
...)

borkdude 2018-11-13T16:21:58.066500Z

where log-charset is an interceptor function

raymcdermott 2018-11-13T16:22:54.067100Z

we have all our routes declared in a bidi form

borkdude 2018-11-13T16:23:10.067600Z

same

raymcdermott 2018-11-13T16:23:56.068100Z

ok, I guess I don’t know what your flow does there

borkdude 2018-11-13T16:24:15.068600Z

(defn insert-interceptor [res point & interceptors]
  (update res :interceptor-chain
          (partial mapcat (fn [i]
                            (if (= i point)
                              (concat interceptors [i])
                              [i])))))
insert-interceptor takes a resource, this is decoupled from your bidi-routes

raymcdermott 2018-11-13T16:25:10.069200Z

I was thinking that I would just add another function to wrap the insertion

raymcdermott 2018-11-13T16:25:38.069400Z

raymcdermott 2018-11-13T16:25:50.069900Z

but you are fancier than me 😉

borkdude 2018-11-13T16:26:06.070200Z

we have a standard resource model that we use to create yada resources

borkdude 2018-11-13T16:26:25.070700Z

that has things like auth etc configured

raymcdermott 2018-11-13T16:26:58.071400Z

ah, ok - we still have a sh1tload of boilerplate

raymcdermott 2018-11-13T16:27:19.072100Z

should clean it up once we get serious

borkdude 2018-11-13T16:27:21.072200Z

so we enrich that with an interceptor for every resource we creeate

raymcdermott 2018-11-13T16:27:35.072400Z

cool, makes sense

raymcdermott 2018-11-13T16:27:43.072600Z

thanks for the advice