Comments (2)
the reason for str->value to front the Clojure reader is because not all configuration and properties come from edn like in your table above. Some of them, quite often, come from ENV, system properties or configuration managers (e.g. Consul).
In those cases types are not as clear. For example, let's look at overriding a "username":
=> (require '[cprop.core :as cp])
=> (cp/load-config)
{:datomic ...
:source
{:account
{:rabbit
{...
:username "guest"}}}
=> (System/setProperty "source_account_rabbit_username" "0x42")
with the way code is written now:
=> (cp/load-config)
{:datomic ...
:source
{:account
{:rabbit
{...
:username "0x42"}}}
relying on Clojure reader (i.e. removing "these lines"):
=> (cp/load-config)
{:datomic ...
:source
{:account
{:rabbit
{...
:username 66}}}
I added better comments and a test so it clarifies things a bit
from cprop.
Thanks for the quick turn-around!
Yeah there’s definitely some overlap where things can be parsed oddly; though I think the times where the reader would mis-parse something would be the vast minority situations.
Anyway, my original intent was lost among my thoughts on the use of the reader: you cannot nil a setting, it’ll be set to “nil” instead. A simple (= “nil” v)
before the alpha number regex should fix the use case.
from cprop.
Related Issues (20)
- Different behavior of System/setProperty vs importing from env HOT 2
- How to update the java env settings? HOT 2
- Add CLI as a source of configuration data HOT 4
- Feature Request: EDN to Properties class HOT 10
- Converting to properties (t/map->properties) fails with Mac environmental variables
- Support for ~ shorthand in load-config :file HOT 2
- :env key? HOT 8
- CLJC files are incompatible with ClojureScript HOT 4
- Non-numeric values are parsed as numbers HOT 8
- why env has a higher priority than command line arguments? HOT 6
- Merging a nil value nils the entire config HOT 3
- Question marks in config values - from ENV -> cprop ? HOT 2
- better match the behavior of `assoc-in` HOT 2
- `cprop.tools/contains-in?` doesn't work with vectors HOT 1
- `load-config :merge` option not merging in specified order HOT 2
- enhancement to `:as-is?` for specific value conversions HOT 2
- Empty files cause issues while loading HOT 8
- Low priority bug : `cprop.tool/map->env-file` doesn't support dotted namespaced keys
- Confusing readme. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cprop.