duct

roklenarcic 2019-02-14T12:42:02.010800Z

Hello. I am trying to use clj-duration in my config.edn, that means using a tag #unit/duration in the EDN. Of course reading config throws an error:

Execution error at integrant.core/read-string (core.cljc:155).
No reader function for tag unit/duration

roklenarcic 2019-02-14T12:42:14.011300Z

how do I resolve this? (if at all possible)

roklenarcic 2019-02-14T14:22:20.011700Z

nvm found out where to put extra readers

scottlowe 2019-02-14T14:27:17.012200Z

Heh. I was just typing a reply in a scratch file before I saw that you’ve already found it. I’ll add the answer here anyway for others.

scottlowe 2019-02-14T14:27:18.012400Z

duct/read-config has an optional readers argument which allows you to supply custom readers.

(def my-readers {'uri #(URI. %)
                 'duration my-duration-function}

;; ...

(duct/read-config (io/resource "blah/blah/config.edn")) my-readers)
You’ll need modify your calls to read-config wherever it is used, which would typically be within main.clj and dev.clj in a vanilla Duct app.

2