Skip to content

Commit

Permalink
add subsystem for reporting problems
Browse files Browse the repository at this point in the history
  • Loading branch information
darwin committed Oct 16, 2016
1 parent 5181af9 commit f915038
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/lib/env_config/core.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns env-config.core
(:require [env-config.impl.read :as read]
[env-config.impl.coerce :as coerce]))
[env-config.impl.coerce :as coerce]
[env-config.impl.report :as report]))

; -- public api -------------------------------------------------------------------------------------------------------------

Expand All @@ -12,6 +13,16 @@
(defn coerce-config [config & [coercers]]
(coerce/coerce-config config (or coercers default-coercers)))

(defn make-config [prefix vars & [coercers]]
(defn prepare-config [prefix vars coercers]
(-> (read-config prefix vars)
(coerce-config coercers)))

(defn make-config [prefix vars & [coercers reports-atom]]
(binding [report/*reports* reports-atom]
(prepare-config prefix vars coercers)))

(defn make-config-with-logging [prefix vars & [coercers reporter]]
(let [reports-atom (atom [])
config (make-config prefix vars coercers reports-atom)]
(report/log-reports-if-needed! @reports-atom reporter)
config))

0 comments on commit f915038

Please sign in to comment.