(build-config spec)
(build-config spec env)
Builds a config from env
according to spec
.
A config is a possibly nested map with keyword keys and typed values, were
env
is a flat map with string keys and string values.
If env
is omitted, (System/getenv)
is used. Otherwise the env
has to
be prepared with prepare-env
before calling build-config
. It's important
that the prepared env keys are sequences of uppercase alphanumeric strings.
The resulting config reassembles the structure of the spec
but doesn't
necessarily conform to the spec
.
The following spec forms are supported:
keys
- the resulting config will be a mapmulti-spec
- the spec resulting from dispatching the multi-spec is usedcoll-of
- all env keys starting with numerical parts are used. Numbers
don't have to start with 0
nor have they be without gab. The
collection is build by sorting available numbers.Supported spec forms can be nested arbitrarily.
Builds a config from `env` according to `spec`. A config is a possibly nested map with keyword keys and typed values, were `env` is a flat map with string keys and string values. If `env` is omitted, `(System/getenv)` is used. Otherwise the `env` has to be prepared with `prepare-env` before calling `build-config`. It's important that the prepared env keys are sequences of uppercase alphanumeric strings. The resulting config reassembles the structure of the `spec` but doesn't necessarily conform to the `spec`. The following spec forms are supported: * `keys` - the resulting config will be a map * `multi-spec` - the spec resulting from dispatching the multi-spec is used * `coll-of` - all env keys starting with numerical parts are used. Numbers don't have to start with `0` nor have they be without gab. The collection is build by sorting available numbers. Supported spec forms can be nested arbitrarily.
Transducer which splits string keys in kv-pairs by underscore.
Transducer which splits string keys in kv-pairs by underscore.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close