Config reading/loading helpers. Adds extensions to aero and default config reader.
Config reading/loading helpers. Adds extensions to aero and default config reader.
(read-config config-path)(read-config config-path
{:keys [profile resolver validate]
:or {resolver aero/resource-resolver}})Reads config from resources. Allowed options:
Reads config from resources.
Allowed options:
- resolver: The resolver to use in aero (default: aero/resource-resolver)
- profile: The profile to use is #profile is used
- validate: A map of keys in the config to be validated.
Keys can be vectors with the path to the config to be validated.
Values can be a map with {<expected key value> <validation fn>} or simply <validation fn>
All validators must return 'truthy' or a validation exception will be raised
Example: for the config
{:env 'prod' :host 'localhost'}
Validation that host can't be localhost in prod can be added with:
(read-config '<the conf file>' {:validate {:env {'prod' #(not (= 'localhost' (:host %2)))}}})cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |