A library to manage application secrets and configuration safely and effectively.
A library to manage application secrets and configuration safely and effectively.
(configure {:keys [env key version] :as config-entry})
(configure config-client {:keys [env key version] :as config-entry})
Returns a configuration entry if found in any of the available
configuration backends or nil
if not found.
example:
(configure {:key "service1" :env "dev" :version "6.2.4"})
;; => {:key "service1",
;; :env "dev",
;; :version "1.0.0",
;; :change-num 1577379732258,
;; :content-type "edn",
;; :value {:config "the actual config" :password "S3cret"},
;; :master-key-alias "alias/1Config/service1",
;; :master-key "arn:aws:kms:eu-west-1:1234567890:key/09f50161-01e7-44f1-9b39-fac39c7267eb",
;; :user "arn:aws:iam::1234567890:user/john.doe"}
When config is not found:
(configure {:key "system-xyz" :env "dev" :version "6.2.4"})
;; => nil
Typical usage:
;; read the config and merge with defaults
(->> (configure
{:key "user-service"
:env (or (System/getenv "ENV") "local")
:version "6.2.4"})
:value
(deep-merge DEFAULT-CONFIG))
for more information check:
Returns a configuration entry if found in any of the available configuration backends or `nil` if not found. example: ``` clojure (configure {:key "service1" :env "dev" :version "6.2.4"}) ;; => {:key "service1", ;; :env "dev", ;; :version "1.0.0", ;; :change-num 1577379732258, ;; :content-type "edn", ;; :value {:config "the actual config" :password "S3cret"}, ;; :master-key-alias "alias/1Config/service1", ;; :master-key "arn:aws:kms:eu-west-1:1234567890:key/09f50161-01e7-44f1-9b39-fac39c7267eb", ;; :user "arn:aws:iam::1234567890:user/john.doe"} ``` When config is not found: ``` clojure (configure {:key "system-xyz" :env "dev" :version "6.2.4"}) ;; => nil ``` Typical usage: ``` clojure ;; read the config and merge with defaults (->> (configure {:key "user-service" :env (or (System/getenv "ENV") "local") :version "6.2.4"}) :value (deep-merge DEFAULT-CONFIG)) ``` for more information check: - the best practices: https://github.com/BrunoBonacci/1config/blob/master/doc/best-practices.md - the general documentation: https://github.com/BrunoBonacci/1config
(deep-merge & maps)
It merges maps recursively. It merges the maps from left to right and the right-most value wins. It is useful to merge the user defined configuration on top of the default configuration.
example:
(deep-merge {:foo 1 :bar {:baz 2}}
{:foo 2 :bar {:baz 1 :qux 3}})
;;=> {:foo 2, :bar {:baz 1, :qux 3}}
It merges maps recursively. It merges the maps from left to right and the right-most value wins. It is useful to merge the user defined configuration on top of the default configuration. example: ``` clojure (deep-merge {:foo 1 :bar {:baz 2}} {:foo 2 :bar {:baz 1 :qux 3}}) ;;=> {:foo 2, :bar {:baz 1, :qux 3}} ```
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close