duct

ccann 2019-10-02T16:21:40.032100Z

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?

kelveden 2019-10-02T16:29:14.032200Z

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.

kelveden 2019-10-02T16:30:30.032400Z

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

kelveden 2019-10-02T16:31:13.032600Z

Something like aero's #ref.

teaforthecat 2019-10-02T16:41:56.032800Z

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

ccann 2019-10-02T16:45:22.033200Z

@teaforthecat nice!

ccann 2019-10-02T16:45:31.033400Z

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

1👍