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?
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/include
ing 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.
Would be interested to hear if other folks have found a cleaner way of doing it though.
Something like aero's #ref
.
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
@teaforthecat nice!
I’ll submit some kind of documentation PR for this in the near-future