Fork me on GitHub

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)


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


pass it as an argument


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


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


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...


should I make a file IO component?


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


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


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


ah I found my problem here: notice that components receive config, but endpoints do not.


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