Liking cljdoc? Tell your friends :D

yle-clj-common.properties


current-envclj

(current-env)

parse-env-or-propertiesclj

(parse-env-or-properties key properties)

Get a value from environment variables or if not found fallback to given properties map.

The properties map can be either flat or nested. The given key must be a kebab-cased keyword. Keywords can contain dots. Dots are transformed to underscores for environment lookup. Environment variable names are transformed to kebab case before lookup.

Throws an exception if no value is found.

Examples:

(parse-env-or-properties :port properties) This finds an environment variable named PORT or a property with the key :port.

(parse-env-or-properties :db.admin-host properties) This finds an environment variable named DB_ADMIN_HOST or property with the key :db.admin-host.

If a value is not found from either environment or a flat properties map, the final fallback is to assume a nested properties map, upon which the key is split to components by its dot characters and looked up recursively. For example, if we have no DB_PORT environment variable set and have the following properties map:

(def properties {:db {:port 1234}})

Then (parse-env-or-properties :db.port properties) would return 1234.

Get a value from environment variables or if not found fallback to given properties map.

The properties map can be either flat or nested.
The given key must be a kebab-cased keyword.
Keywords can contain dots. Dots are transformed to underscores for environment lookup.
Environment variable names are transformed to kebab case before lookup.

Throws an exception if no value is found.

Examples:

`(parse-env-or-properties :port properties)`
This finds an environment variable named `PORT` or a property with the key `:port`.

`(parse-env-or-properties :db.admin-host properties)`
This finds an environment variable named `DB_ADMIN_HOST` or property with the key `:db.admin-host`.

If a value is not found from either environment or a flat properties map, the final fallback
is to assume a nested properties map, upon which the key is split to components by its dot
characters and looked up recursively. For example, if we have no DB_PORT environment variable set
and have the following properties map:

`(def properties {:db {:port 1234}})`

Then `(parse-env-or-properties :db.port properties)` would return 1234.
raw docstring

parse-env-propertyclj

(parse-env-property key)

Tries to get a value from environment variables.

Returns nil if value is empty or undefined.

Tries to get a value from environment variables.

Returns `nil` if value is empty or undefined.
raw docstring

parse-propertyclj

(parse-property properties key)

Returns a value from a properties map matching the given key.

At first assumes the properties map is flat. If a value is not found, then the key is split into components by its dot . characters and then a nested properties map is assumed, which is traversed according to the key components.

Throws an exception if value is not found.

Returns a value from a properties map matching the given key.

At first assumes the properties map is flat. If a value is not found,
then the key is split into components by its dot `.` characters and
then a nested properties map is assumed, which is traversed according
to the key components.

Throws an exception if value is not found.
raw docstring

(print-properties properties)

unit-test-envclj

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

× close