Fork me on GitHub
#duct
<
2019-10-02
>
ccann16:10:40

I have a key I want to set like so :foo.api/origin #duct/env ["FOO_ORIGIN" Str] and then reference in other components, but I don’t have any initialization to do for foo.api/origin, it is effectively just capturing the env var and propagating it out to other components. Is there a better way to do this than an init-key that’s a no-op?

kelveden16:10:14

I've never found a satisfactory way of referencing keys in duct config without making those keys full integrant keys. What I've ended up doing instead is putting what I want to reuse into a "snippet" edn file and then #duct/includeing it wherever I want to reuse it. That would probably be overkill for you though in your case - easier just to reference the env var in multiple places instead.

kelveden16:10:30

Would be interested to hear if other folks have found a cleaner way of doing it though.

kelveden16:10:13

Something like aero's #ref.

teaforthecat16:10:56

I found this: https://github.com/duct-framework/duct/issues/96 It looks like you could put {:foo.api/origin [:duct/const]} in your duct_hierarchy.edn to avoid writing an init-key method

ccann16:10:31

I’ll submit some kind of documentation PR for this in the near-future

👍 4