Currently cprop assumes that all parts of a key path are keywords. Because of this assumption, only nested maps may be overridden by ENV vars, System properties, et al.
However, cprop uses assoc-in to make these updates which can support indices if the current root level is a non-map:
user=> (def servers {:redis [{:url "hi"}]
#_=> :es [{:url "world"}
#_=> {:url "!"}]})
#'user/servers
user=> (assoc-in servers [:redis 0 :url] "hello")
{:redis [{:url "hello"}], :es [{:url "world"} {:url "!"}]}
I propose one of two options:
- If a part of a path matches
#"^\d+$" then it should be treated as a long instead of a keyword to better align with assoc-in's behavior.
- Provide a way to inject a parsing function into the
k->path function so users can parse paths in ways they would expect.
Currently
cpropassumes that all parts of a key path are keywords. Because of this assumption, only nested maps may be overridden by ENV vars, System properties, et al.However,
cpropusesassoc-into make these updates which can support indices if the current root level is a non-map:I propose one of two options:
#"^\d+$"then it should be treated as alonginstead of akeywordto better align withassoc-in's behavior.k->pathfunction so users can parse paths in ways they would expect.