component

2016-11-01T18:38:19.000215Z

In using component + duct, I'm faced with routing config (stored in local edn file) into non-components. How do I get a constant, immutable directory location (just a string) routed into function that needs it, without making that function a component (since it's never really started and stopped in any meaningful way)

2016-11-01T18:39:05.000216Z

i could just have a def at the top of that namespace, but that feels like an anti-pattern compared to having it in config

2016-11-01T18:40:27.000217Z

pass it as an argument

2016-11-01T18:57:35.000218Z

ah, so then whichever component needs that non-component, will also need the config for the non-component passed in to it

2016-11-01T18:58:32.000220Z

that seems a bit cumbersome since certain components shouldn't need to care about the non-component's details, right?

2016-11-01T19:22:18.000222Z

also, i just realized that in my case, the config is a string, a path to a local private key, that could be loaded once and read many times, but if I always just pass that string as a parameter, I'll be doing a ton of IO unecessarily...

2016-11-01T19:22:42.000223Z

should I make a file IO component?

2016-11-01T19:29:04.000224Z

and maybe a boundary/protocol specific to that key file?

seancorfield 2016-11-01T19:36:16.000225Z

Sounds like you have a “config” Component — when you start it you read the files etc, and then you can read freely from it.

2016-11-01T19:45:24.000226Z

thanks sean, i'm still trying to wrap my brain around how things should be flowing through components, and systems

2016-11-01T20:27:59.000227Z

ah I found my problem here: https://github.com/duct-framework/duct/blob/master/duct/src/duct/util/system.clj#L17 notice that components receive config, but endpoints do not.

2016-11-01T20:31:29.000229Z

woo, solved it. If I include a key in config, i just need to add a dependency to that key. I thought dependencies were just to components, but I guess I can depend on config too