You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-22
Original file line number
Diff line number
Diff line change
@@ -97,7 +97,7 @@ Aero provides a small library of tag literals.
97
97
Use `#env` to reference an environment variable.
98
98
99
99
```clojure
100
-
{:password #env DATABASE_URI}
100
+
{:database-uri #env DATABASE_URI}
101
101
```
102
102
103
103
It is considered bad practice to use environment variables for passwords and other confidential information. This is because it is very easy for anyone to read a process's environment (e.g. via `ps -ef`). Environment variables are also commonly dumped out in a debugging sessions. Instead you should use `#include` - see [here](#hide-passwords-in-local-private-files).
@@ -115,7 +115,7 @@ Use `#envf` to insert environment variables into a formatted string.
115
115
Use `#or` when you want to provide a list of possibilities, perhaps with a default and the end.
116
116
117
117
```clojure
118
-
{:password #or [#env PORT 8080]}
118
+
{:port #or [#env PORT 8080]}
119
119
```
120
120
121
121
### join
@@ -133,7 +133,7 @@ Use `#or` when you want to provide a list of possibilities, perhaps with a defau
133
133
134
134
Use profile as a kind of reader conditional.
135
135
136
-
`#profile` expects a map, from which is extracts the entry corresponding to the of__profile__.
136
+
`#profile` expects a map, from which it extracts the entry corresponding to the __profile__.
137
137
138
138
```clojure
139
139
{:webserver
@@ -220,37 +220,37 @@ Merge multiple maps together
220
220
#merge [{:foo:bar} {:foo:zip}]
221
221
```
222
222
223
-
### Define your own
224
-
225
-
Aero supports user-defined tag literals. Just extend the `reader` multimethod.
226
-
227
-
```clojure
228
-
(defmethodreader `mytag
229
-
[{:keys [profile] :as opts} tag value]
230
-
(if (= value :favorite)
231
-
:chocolate
232
-
:vanilla))
233
-
```
234
-
235
-
## Using `^:ref` metadata for references
223
+
### ref
236
224
237
-
To avoid duplication you can refer to other parts of you configuration file using `^:ref`metadata.
225
+
To avoid duplication you can refer to other parts of your configuration file using the `#ref`tag.
238
226
239
-
The `^:ref` value should be a vector resolveable by `get-in`. Take the following config map for example:
227
+
The `#ref` value should be a vector resolveable by `get-in`. Take the following config map for example:
240
228
241
229
```clojure
242
230
{:db-connection"datomic:dynamo://dynamodb"
243
231
:webserver
244
-
{:db^:ref [:db-connection]}
232
+
{:db#ref [:db-connection]}
245
233
:analytics
246
-
{:db^:ref [:db-connection]}}
234
+
{:db#ref [:db-connection]}}
247
235
```
248
236
249
237
Both `:analytics` and `:webserver` will have their `:db` keys resolved
250
238
to `"datomic:dynamo://dynamodb"`
251
239
252
240
References are recursive. They can be used in `#include` files.
253
241
242
+
### Define your own
243
+
244
+
Aero supports user-defined tag literals. Just extend the `reader` multimethod.
245
+
246
+
```clojure
247
+
(defmethodreader 'mytag
248
+
[{:keys [profile] :as opts} tag value]
249
+
(if (= value :favorite)
250
+
:chocolate
251
+
:vanilla))
252
+
```
253
+
254
254
## Deferreds
255
255
256
256
Sometimes you may not want your tag literal to be run during the EDN load, but only after the tree has fully loaded.
@@ -277,8 +277,8 @@ Here is how this can be achieved:
277
277
{:secrets #include #join [#env HOME "/.secrets.edn"]
278
278
279
279
:aws-secret-access-key
280
-
#profile {:test^:ref [:secrets:aws-test-key]
281
-
:prod^:ref [:secrets:aws-prod-key]}}
280
+
#profile {:test#ref [:secrets:aws-test-key]
281
+
:prod#ref [:secrets:aws-prod-key]}}
282
282
```
283
283
284
284
### Use functions to wrap access to your configuration.
0 commit comments