Fork me on GitHub
Yehonathan Sharvit06:07:04

@kevin.van.rooijen What a good place to manually save the state in an atom?


I just created a db.clj or config.clj file and stored it there (with defonce)


Sorry, I literally can't because I don't work for that company anymore and don't have access to the code 😅 But something along these lines:

(ns simple.main
  (:require [duct.core :as duct]))

(defonce stored-config (atom nil))
(defonce stored-system (atom nil))


(defn -main [& args]
  (let [keys     (or (duct/parse-keys args) [:duct/daemon])
        profiles [:duct.profile/prod]
        config (-> (duct/resource "simple/config.edn")
                   (duct/prep-config profiles))
        system (ig/init config keys)]
    (reset! stored-config config)
    (reset! stored-system system)
    (duct/await-daemons system)))