duct

miridius 2019-03-27T08:09:57.048400Z

Hi all, is there any documentation on how duct.profile keys work? e.g. :duct.profile/local. Can I create more profiles and can I switch between profiles in the repl?

2019-03-27T08:48:20.050100Z

There is not so much documentation available, but you can read the code.

(defn -main [& args]
  (let [keys     (or (duct/parse-keys args) [:duct/daemon])
        profiles [:duct.profile/prod]]
    (-> (duct/resource "film_ratings/config.edn")
        (duct/read-config)
        (duct/exec-config profiles keys)))) ; Heres the entry point for production profile

2019-03-27T08:48:55.050600Z

If you look into dev/src/dev.clj

(def profiles
  [:duct.profile/dev :duct.profile/local])

...
(integrant.repl/set-prep! #(duct/prep-config (read-config) profiles)) ; here we change the prep fn and use profiles defined above

2019-03-27T08:51:32.051Z

When you call (go) the code will call (prep) and then (init) https://github.com/weavejester/integrant-repl/blob/89a9552fd3623976b83318a5f8f903f1ebeda2f7/src/integrant/repl.clj#L53

2019-03-27T08:53:33.052300Z

And init will start the system

2019-03-27T08:58:37.053100Z

You definitely can create more profiles.

2019-03-27T08:59:36.053600Z

Just remember to derive from :duct/profile

2019-03-27T09:03:04.054400Z

And add :duct.profile/yourown #duct/include "yourown" in config.edn

2019-03-27T09:10:19.056600Z

About switching profiles I think you can execute (def profiles [:duct.profile/dev :duct.profile/yourown]) inside the dev ns in the repl. Although I’ve never did that and don’t know how it might affect the system.

miridius 2019-03-27T09:27:01.057Z

Thanks! that's very helpful 🙂 I'll play around with it at the repl