Fork me on GitHub
#duct
<
2019-02-14
>
roklenarcic12:02:02

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

roklenarcic12:02:14

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

roklenarcic14:02:20

nvm found out where to put extra readers

scottlowe14:02:17

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.

scottlowe14:02:18

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.

10