Configuration functionality. This reads the application configuration from various sources, like environment vars or command-line args. The configuration is structured in a hierarchy and optionally some values are converted. Then this configuration is used to add any 'constructor functions', that are then used to create new functions to do some actual work. This allows us to change the behaviour of the application with configuration, but also makes it possible to inject dummy functions for testing purposes.
Configuration functionality. This reads the application configuration from various sources, like environment vars or command-line args. The configuration is structured in a hierarchy and optionally some values are converted. Then this configuration is used to add any 'constructor functions', that are then used to create new functions to do some actual work. This allows us to change the behaviour of the application with configuration, but also makes it possible to inject dummy functions for testing purposes.
(app-config env args)
Combines app environment with command-line args into a unified configuration structure. Args have precedence over env vars, which in turn override config loaded from files and default values.
Combines app environment with command-line args into a unified configuration structure. Args have precedence over env vars, which in turn override config loaded from files and default values.
Default configuration for the application, without env vars or args applied.
Default configuration for the application, without env vars or args applied.
(group-and-merge-from-env m prefix)
Given a map, takes all keys in :env
that start with the given prefix
(using group-keys
) and merges them with the existing submap with same
key.
For example, {:env {:test-key "value"} :test {:other-key "other-value"}}
would become {:test {:key "value" :other-key "other-value"}}
.
The newly grouped values overwrite any existing values.
Given a map, takes all keys in `:env` that start with the given prefix (using `group-keys`) and merges them with the existing submap with same key. For example, `{:env {:test-key "value"} :test {:other-key "other-value"}}` would become `{:test {:key "value" :other-key "other-value"}}`. The newly grouped values overwrite any existing values.
(group-keys m prefix)
Takes all keys in given map m
that start with :prefix-
and
moves them to a submap with the prefix name, and the prefix
stripped from the keys. E.g. {:test-key 100}
with prefix :test
would become {:test {:key 100}}
Takes all keys in given map `m` that start with `:prefix-` and moves them to a submap with the prefix name, and the prefix stripped from the keys. E.g. `{:test-key 100}` with prefix `:test` would become `{:test {:key 100}}`
(load-config-file f)
Loads configuration from given file. This supports json and edn and converts keys always to kebab-case.
Loads configuration from given file. This supports json and edn and converts keys always to kebab-case.
(load-raw-config extra-files)
Loads raw (not normalized) configuration from its various sources
Loads raw (not normalized) configuration from its various sources
(normalize-typed k conf f)
Convenience function that converts the :type
of an entry into a keyword and
then invokes f
on it.
Convenience function that converts the `:type` of an entry into a keyword and then invokes `f` on it.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close