The default config function. It searches for config.json, config.edn and config.clj on the classpath (in that order) and returns a fuction with the signature of (fn [& ks] ...)
To retrieve a config value in the following configuration...
{:name "bob" :address {:street "42 Main St." :city "..." ...}}
...one would call (config :address :street) to retrieve "42 Main St."
The default config function. It searches for config.json, config.edn and config.clj on the classpath (in that order) and returns a fuction with the signature of (fn [& ks] ...) To retrieve a config value in the following configuration... {:name "bob" :address {:street "42 Main St." :city "..." ...}} ...one would call (config :address :street) to retrieve "42 Main St."
(config* m ks)
Looks up the keys in the maps. If not found, log and return nil.
Looks up the keys in the maps. If not found, log and return nil.
(configurer resources)
(configurer resources middleware)
Given a the list of resources in the format expected by get-configs, return a function that can be used to search the configuration files in the following manner.
Additionally, configurer can take a seq of config middleware. Each middleware function is called with a single function as an input and should return a function that takes the config map as an input. See cache-config or eval-config for example middleware. Middleware is applied in the order in which it is defined in the map. If you do not provide any middleware, then the default middlware will be used.
Given a the list of resources in the format expected by get-configs, return a function that can be used to search the configuration files in the following manner. Additionally, configurer can take a seq of config middleware. Each middleware function is called with a single function as an input and should return a function that takes the config map as an input. See cache-config or eval-config for example middleware. Middleware is applied in the order in which it is defined in the map. If you do not provide any middleware, then the default middlware will be used.
The default list of middleware carica uses.
The default list of middleware carica uses.
(get-configs resources)
Takes a data structure of config resources (URLs) in priority order and merges them together. The resources can be a simple list where first-in wins. Additionally the structure may contain maps where the key becomes the effective namespace of the resources in the value.
Each node is handled by type:
E.g., the following: [#<URL file:/some/path1> {:ns1 [#<URL file:/some/path2> #<URL file:/some/path3>]}]
would become: {<keys and values from /some/path> :ns1 {<the merged keys and value from path2 and path3>}}
Takes a data structure of config resources (URLs) in priority order and merges them together. The resources can be a simple list where first-in wins. Additionally the structure may contain maps where the key becomes the effective namespace of the resources in the value. Each node is handled by type: - resources (URL): load the config - collections (except for maps): merge the members - all others, return as is E.g., the following: [#<URL file:/some/path1> {:ns1 [#<URL file:/some/path2> #<URL file:/some/path3>]}] would become: {<keys and values from /some/path> :ns1 {<the merged keys and value from path2 and path3>}}
Determine if cheshire is loaded and json parsing is available.
Determine if cheshire is loaded and json parsing is available.
(json-parse-stream & args)
Resolve and apply cheshire's json parsing dynamically.
Resolve and apply cheshire's json parsing dynamically.
Load and read the config into a map of Clojure maps. Dispatches based on the file extension.
Load and read the config into a map of Clojure maps. Dispatches based on the file extension.
Useful for testing, override-config enables overriding config values. It takes a series of keys and a replacement value.
E.g., these are all equivalent: (with-redefs [config (override-config {:address {:street "42 Broadway"}}) (with-redefs [config (override-config :address {:street "42 Broadway"}) (with-redefs [config (override-config :address :street "42 Broadway")
It isn't possible to remove any values, though they can be replaced with nil. E.g., (with-redefs [config (override-config nil)])
Useful for testing, override-config enables overriding config values. It takes a series of keys and a replacement value. E.g., these are all equivalent: (with-redefs [config (override-config {:address {:street "42 Broadway"}}) (with-redefs [config (override-config :address {:street "42 Broadway"}) (with-redefs [config (override-config :address :street "42 Broadway") It isn't possible to remove any values, though they can be replaced with nil. E.g., (with-redefs [config (override-config nil)])
(overrider cfg-fn)
Convenience macro to get the var for the passed config function and create the overrider function.
Convenience macro to get the var for the passed config function and create the overrider function.
(overrider* cfg-fn-var)
Creates a custom overrider function from the given config function var.
Creates a custom overrider function from the given config function var.
(reduce-into-map overrides)
Turns the flat list of keys -> value into a tree of maps. E.g., [:foo :bar :baz 4] becomes {:foo {:bar {:baz 4}}}
Turns the flat list of keys -> value into a tree of maps. E.g., [:foo :bar :baz 4] becomes {:foo {:bar {:baz 4}}}
(resources path)
Search the classpath for resources matching the given path
Search the classpath for resources matching the given path
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close