juxt

2019-08-08T13:59:28.024100Z

I'm having a discussion regarding aero and config best practices with a few colleagues

2019-08-08T13:59:49.024800Z

I can see in your README that you suggest to have functions like

(defn something-enabled [config] (get-in config [...])

2019-08-08T14:01:05.026800Z

I kind of prefer to think about configuration as to a global constant map, so instead of passing it around everywhere I just have do calls like (config/value :nested :key) and then do some simple caching to not reload the config too many times in prod

2019-08-08T14:02:01.027800Z

I understand that in theory passing around the config map is more functional, but at the same time, if we do want to pass different arguments, we just use anyway a #profile in the aero config

2019-08-08T14:02:33.028800Z

anyway the question is just, is that what you actually do to pass around the config everywhere and have a function for every configuration value?

dominicm 2019-08-08T14:32:13.029400Z

Neither 😛

dominicm 2019-08-08T14:32:45.030200Z

We've primarily migrated to integrant as our strategy for the config, and store our integrant system in the config.edn. Then the integrant system can #ref config to itself.

dominicm 2019-08-08T14:34:55.031700Z

You can see this happening in Edge https://github.com/juxt/edge/blob/master/examples/tutorial.vent/src/config.edn For example the builder has separate config based on the profile: https://github.com/juxt/edge/blob/master/examples/tutorial.vent/src/config.edn#L64-L65 but could also use #ref. Notable is the granularity, each web endpoint has it's own component, so gets the granularity of config it needs. e.g. https://github.com/juxt/edge/blob/master/examples/tutorial.vent/src/config.edn#L3 We have applied this pattern to component as well, so it seems general. Although integrant is the easiest combo we've seen thus far.

2019-08-08T15:19:13.032Z

ah cool thanks

dominicm 2019-08-08T16:32:16.033300Z

can't speak much to your exact use-case, but I definitely prefer parameterized configuration over external global reads, it means that the tests can be run in parallel and functions can be composed by default (i.e. not requiring refactoring to make a -config variant).