Liking cljdoc? Tell your friends :D

Aero Extensions

This is a Clojure lib that adds some more tag readers to use with Aero. This is a configuration library that reads .edn files but adds some additional functionality to it. For use with our own projects, we have created this library, that adds some more extensions.

Usage

First include the library:

;; deps.edn
{:deps {com.monkeyprojects/aero-ext {:mvn/version "<version>"}}}

Then enable the readers just by requiring the ns:

(require '[monkey.aero])

;; Load something with aero
(require '[aero.core :as ac])

;; This will automatically process any extension readers
(ac/read-config "path/to/edn/file")

Available Readers

These are the readers that are provided by this library.

to-edn

Serializes the argument to an edn string.

{:config-str #to-edn {:key "value"}}

from-edn

Opposite of #to-edn, parses an edn string:

{:config-str #from-edn "{:key \"value\"}"}

This is useful when you want to process an edn file before including it in your config (like decrypting it).

deep-merge

Similar to Aero's #merge, this performs a deep merge. Existing maps don't overwrite eachother, but are merged again:

{:value #deep-merge [{:first {:second "value"}}
                     {:first {:third "other value"}}]}

This will result in a map like this:

{:value
 {:first
  {:second "value"
   :third "other value"}}}

file

To include any file as a string in your config, use #file:

{:log-config #file "path/to/file"}

This is not the same as the Aero-provided #include, because #include will parse the file as edn, whereas #file will just read it as raw text. This will use the :resolver as configured when reading the config.

to-b64

This will encode the argument to Base64.

{:password #to-b64 #env PASSWORD}

Useful for including binary data.

from-b64

Similar to #to-b64, this will decode from Base64

{:password #from-b64 #env PASSWORD}

privkey

Will parse the argument as a PEM-encoded private key. The result is a java.security.PrivateKey.

{:private-key #privkey #file "ssh/private-key.pem"}

License

Copyright (c) 2024 by Monkey Projects BV

MIT License

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close