Fork me on GitHub
#duct
<
2019-03-27
>
miridius08:03:57

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?

jahson08:03:20

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

jahson08:03:55

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

jahson08:03:33

And init will start the system

jahson08:03:37

You definitely can create more profiles.

jahson08:03:36

Just remember to derive from :duct/profile

jahson09:03:04

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

jahson09:03:19

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.

miridius09:03:01

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