Skip to content

Commit

Permalink
#28: add docs to :override-with
Browse files Browse the repository at this point in the history
  • Loading branch information
tolitius authored Jul 9, 2019
1 parent 1cd439c commit 802d320
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ where all configuration properties converge
- [Using properties](#using-properties)
- [Merging Configurations](#merging-configurations)
- [Merging with all System and ENV](#merging-with-all-system-and-env)
- [Override all configs](#override-all-configs)
- [Merging with system properties](#merging-with-system-properties)
- [System properties cprop syntax](#system-properties-cprop-syntax)
- [Merging with ENV variables](#merging-with-env-variables)
Expand Down Expand Up @@ -223,6 +224,28 @@ It can get as creative as needed, but.. _this should cover most cases_:
(load-config)
```

### Override all configs

cprop merges _matching_ properties and ENV variables by default. In order to override that, or any other configs, properties or ENV variables `load-congfig` function takes an optional `:override-with` argument with a map that will override any matching (top level or however deeply nested) properties. If provided, this would be the last merge step applied after "all":

```bash
$ export DATOMIC__URL=foo
```

```clojure
=> (load-config))
{:datomic {:url "foo"},
:source ... }
```

but could be overriden with:

```clojure
=> (load-config :override-with {:datomic {:url "bar"}})
{:datomic {:url "bar"},
:source ... }
```

## Merging with system properties

By default cprop will merge all configurations with system properties that match the ones that are there in configs (i.e. intersection).
Expand Down

0 comments on commit 802d320

Please sign in to comment.