confick is a tiny library to load and cache configuration data from an edn file.
The library can be installed from Clojars:
(require '[confick.core :refer [bind lookup]])
;; receive (mandatory) configuration value
(lookup [:tcp :address] :required true)
;; bind configuration values in a let block
(bind [^:required addr [:tcp :address]
^{:default 80 :conform nat-int?} port [:tcp :port]]
(println (format "%s:%d" addr port)))
;; access configuration values in edn
(require '[confick.edn :as edn])
(edn/read-string "{:address #cnf/req [:tcp port] :port #cnf/or [[:tcp :port] 80]}")
The default relative path of the configuration file is "config.edn". It gets overwritten by the CONFICK_PATH environment variable or Java system property.
Set CONFICK_CACHE_MILLIS to zero to disable caching.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close