This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-01
Channels
- # aleph (1)
- # bangalore-clj (5)
- # beginners (24)
- # boot (113)
- # cider (42)
- # cljs-dev (2)
- # cljsjs (2)
- # cljsrn (3)
- # clojure (37)
- # clojure-austin (4)
- # clojure-brasil (3)
- # clojure-france (55)
- # clojure-greece (15)
- # clojure-ireland (4)
- # clojure-italy (13)
- # clojure-russia (37)
- # clojure-spec (50)
- # clojure-uk (31)
- # clojurescript (49)
- # component (12)
- # consulting (1)
- # cursive (6)
- # datascript (9)
- # datomic (27)
- # editors (2)
- # garden (1)
- # hoplon (18)
- # jobs (1)
- # klipse (25)
- # lein-figwheel (1)
- # leiningen (1)
- # luminus (2)
- # om (53)
- # om-next (8)
- # onyx (5)
- # parinfer (4)
- # perun (4)
- # re-frame (13)
- # remote-jobs (1)
- # ring (1)
- # ring-swagger (3)
- # rum (52)
- # spacemacs (36)
- # specter (13)
- # sql (3)
- # untangled (49)
- # vim (11)
- # yada (9)
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
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:
https://github.com/duct-framework/duct/blob/master/duct/src/duct/util/system.clj#L17
notice that component
s receive config
, but endpoint
s 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