This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-20
Channels
- # aatree (42)
- # admin-announcements (25)
- # alda (28)
- # aws (56)
- # beginners (67)
- # boot (248)
- # braid-chat (9)
- # cider (52)
- # cljsrn (11)
- # clojars (4)
- # clojure (341)
- # clojure-czech (5)
- # clojure-japan (3)
- # clojure-nl (2)
- # clojure-russia (57)
- # clojured (10)
- # clojurescript (35)
- # community-development (18)
- # cursive (17)
- # datascript (5)
- # datomic (39)
- # dirac (25)
- # editors (2)
- # events (3)
- # hoplon (60)
- # jobs (5)
- # ldnclj (9)
- # leiningen (5)
- # mount (20)
- # off-topic (3)
- # om (263)
- # onyx (69)
- # perun (5)
- # proton (55)
- # re-frame (7)
- # reagent (24)
- # spacemacs (6)
- # yada (16)
@bbss: interesting, https://github.com/boot-clj/boot/blob/master/boot/core/src/boot/core.clj#L999 which version of boot (`boot -V`) are you using?
Is there a best-practice for ensuring mount has started in the context of a lein task or run alias?
I'm guessing there's probably a better way than just starting off the exposed functions with (mount/start)
I suppose this is applicable to tests too… or really anything that exercises a namespace with a defstate
that doesn't come in through a -main
or something that can call (mount/start)
@voxdolo: takes time to collect practices whether good or bad , so such practice yet.. the way I see mount is used (and the way I use it) is I start it from either -main
or an app entry point (i.e. handler). there is also a way to hook it up to ring :init
(I can share an example if it is something that would help you).
since (mount/start)
is just a function, it can definitely be hooked up with lein or boot task of course
I've just set my handler itself to a defstate
since it has a middleware that depends on environment variables that may not be available during AoT… The handler is only referenced in one place, so I just call (mount/start) before that, and it seems to work fine thus far.
my issue is when I have some function that has external access that depends on state that I've encapsulated in mount
e.g. I have a lein migrate
task that's just a run alias, but it needs to reference a db-connection that's wrapped with mount
fwiw though, it's totally possible I've got entirely the wrong idea about how to use mount
ah.. I see what you mean. hmm.. will need to think about it. I wonder whether it can be done with lein hooks of some sort. In my tests, I actually have (mount/start)
explicitly, moreover I only start states that are needed for those tests: i.e. (mount/start #'a/state #'b/state)
Ah, yeah… I'm putting this in an application after-the-fact to try to cure my AoT woes, so I've been using (mount/start)
as The Big Gun. I should probably be more selective about what I'm starting...