Fork me on GitHub
#duct
<
2018-03-19
>
kardan16:03:57

How do you go about this in the new Duct with Integrant?

dadair17:03:38

@kardan just to clarify, are you asking how to grab ENV vars in Duct with Integrant?

dadair17:03:31

or how to map from external env vars to an internal naming scheme for vars (in a single map)?

dadair17:03:17

if the former, you do it as part of the config map: :some-key {:some-var #duct/env ["EXTERNAL_NAME" <Some Coercing Function> :or "some-default"]}

dadair17:03:53

e.g., :some-component-key {:db-url #duct/env ["DB_URL" Str :or "some-default-value"]}

dadair17:03:18

if you want to build a map of all env vars that you can pass around as a whole, you could simply repeat the pattern above: :my-env-map {:a #duct/env [..] :b #duct/env [..] :c #duct/env [..] ..} and then pass the env map to other components through refs: :some-other-component {:envs #ig/ref :my-env-map}

dadair17:03:11

does that answer your question?

kardan17:03:05

Ah, yes! Thanks

kardan17:03:37

Maybe I’m just slow after a long day. But this what I was trying to understand while staring at the screen 🙂