(cache-config f)
Config middleware that will cache the config map so that it is loaded only once.
Config middleware that will cache the config map so that it is loaded only once.
(clear-config-cache! & [config-fn])
Clear the cached config. If a custom config function has been defined, it must be passed in.
Clear the cached config. If a custom config function has been defined, it must be passed in.
(env-override-config)
(env-override-config env-var-name)
(env-override-config env-var-name parent-key)
Middleware that will override keys based on the value of a configurable environment variable and optional parent key.
The environment variable defaults to CARICA_ENV with no parent key in the map.
E.g., given the following config map:
{:some :other :values :here :retries 1 :env-override {:prod {:some :awesome :retries 5}}}
Then adding the following to the list of Carica middleware will result in the config shown below.
(env-override-config "MY_CFG_VAR" :env-override)
{:some :awesome :values :here :retries 5}
Middleware that will override keys based on the value of a configurable environment variable and optional parent key. The environment variable defaults to CARICA_ENV with no parent key in the map. E.g., given the following config map: {:some :other :values :here :retries 1 :env-override {:prod {:some :awesome :retries 5}}} Then adding the following to the list of Carica middleware will result in the config shown below. (env-override-config "MY_CFG_VAR" :env-override) {:some :awesome :values :here :retries 5}
(env-substitute-config env-var-name & keyseq)
Middleware that will override a known key with the value of an environment variable.
Given this config map: {:something 1 :otherthing 2}
Given this middleware definition: (env-substitute-config "MY_OTHER_THING" :otherthing)
Given an execution environment with a definition like this export MY_OTHER_THING=5
This config will result: {:something 1 :otherthing 5}
Middleware that will override a known key with the value of an environment variable. Given this config map: {:something 1 :otherthing 2} Given this middleware definition: (env-substitute-config "MY_OTHER_THING" :otherthing) Given an execution environment with a definition like this export MY_OTHER_THING=5 This config will result: {:something 1 :otherthing 5}
(eval-config f)
Config middleware that will evaluate the config map. This allows arbitrary code to live in the config file. It is often useful for coercing config values to a particular type.
Config middleware that will evaluate the config map. This allows arbitrary code to live in the config file. It is often useful for coercing config values to a particular type.
(get-config-fn f)
Retrieve the wrapped fn from the middleware, or return f if it isn't wrapped.
Retrieve the wrapped fn from the middleware, or return f if it isn't wrapped.
(get-options f)
Retrieve the exposed options from the wrapped middleware, or return {} if the middleware isn't wrapped.
Retrieve the exposed options from the wrapped middleware, or return {} if the middleware isn't wrapped.
(getenv env-var-name)
This indirection allows overriding in tests
This indirection allows overriding in tests
(middleware-compose f mw)
Unwrap and rewrap the function and middleware. Used in a reduce to create the actual config funtion that is eventually called to fetch the values from the config map.
Unwrap and rewrap the function and middleware. Used in a reduce to create the actual config funtion that is eventually called to fetch the values from the config map.
(unwrap-middleware-fn f)
Convenience function for pulling the fn and options out of the wrapped middleware. It's easier to destructure a seq than a map with namespaced keys.
Convenience function for pulling the fn and options out of the wrapped middleware. It's easier to destructure a seq than a map with namespaced keys.
(wrap-middleware-fn f & [opt-map])
Take the passed function and an optional map of options and return the wrapped middleware map that the rest of the code expects to use.
Take the passed function and an optional map of options and return the wrapped middleware map that the rest of the code expects to use.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close