@ -8,11 +8,19 @@
(def config-defaults {:issuer "staging"
(def config-defaults {:issuer "staging"
:volume-size "3"})
:volume-size "3"})
; TODO: gec 2022/10/28: That does only work if the :websites and :auth collections have the same order regarding :unique-name!
; There must be a check or the config must be sorted first!
(defn flatten-and-reduce-config
(defn flatten-and-reduce-config
[config]
[unsorted-config]
(merge (-> config :websites first) (-> config :auth first) (dissoc config :websites :auth)))
(let [sorted-websites (into [] (sort-by :unique-name (unsorted-config :websites)))
sorted-auth (into [] (sort-by :unique-name (unsorted-config :auth)))
config (-> unsorted-config
(assoc-in [:websites] sorted-websites)
(assoc-in [:auth] sorted-auth))]
(merge (-> config :websites first)
(-> config :auth first)
(when (contains? config :issuer)
{:issuer (config :issuer)})
(when (contains? config :volume-size)
{:volume-size (config :volume-size)}))))
; TODO: Find a better readable expression.
; TODO: Find a better readable expression.
(defn generate-configs [config]
(defn generate-configs [config]