This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-30
Channels
- # admin-announcements (42)
- # alda (8)
- # aws (10)
- # beginners (22)
- # boot (165)
- # bristol-clojurians (1)
- # cider (6)
- # clara (21)
- # cljs-dev (23)
- # clojure (74)
- # clojure-dev (8)
- # clojure-russia (41)
- # clojurescript (180)
- # core-async (11)
- # cursive (26)
- # datascript (2)
- # datavis (7)
- # datomic (29)
- # editors (1)
- # hoplon (7)
- # jobs (3)
- # ldnclj (4)
- # lein-figwheel (47)
- # leiningen (2)
- # mount (26)
- # off-topic (3)
- # om (163)
- # onyx (56)
- # proton (4)
- # reagent (6)
- # remote-jobs (1)
- # ring-swagger (4)
- # spacemacs (9)
Hi all… I’m trying to figure out how to integrate command-line argument processing with mount, and having some trouble with it
My basic idea is that my app starts up and reads a config file config.edn
…and then I parse the command-line via tools.cli and override certain values, like maybe I’ve got a --port 3000
command-line option
So ideally everything looking for the config, eg the web server, just requires [foo.config :refer [app-config]]
to get the config
…but I can’t figure out how to set the ns dependency tree up so this is possible
Any ideas?
@timgilbert: have you looked at https://github.com/tolitius/mount#runtime-arguments?
Uh...
Oh, I totally missed that in the README, sorry
Ok, great. Thanks, that’s exactly what I was wondering about
Reading comprehension fail
So in this case, I wouldn’t be able to refer to the parsed config from the main ns, right? Otherwise I’d get a circular dependency on config?
I can probably just deal with the processing inside of config, I guess
Yeah, so like maybe I define addresses for three deployment environments in the config and the CLI args specify one
Ok, right, so the validation would occur when I’m reconciling the args and the file, that makes sense actually
mount will remember those args, so you can use them to override / create a namespace level config
Ok, I think I see how to proceed. Thanks! mount seems like a great library
I will
btw that branch with the example is from the old mount version, which still makes the example valid, but uses some "older ways", e.g. https://github.com/tolitius/mount/blob/with-args/test/app/config.clj#L2 should be mount.core :refer
, etc..