Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ After parsing and reader macro expansion, the resulting data will be:
{:connection-pool
{:user-name "accountsuser"
:user-pw "change-me"
:url "jdbc:postgresql://db.example.org:5432/accounts"]}
:url "jdbc:postgresql://db.example.org:5432/accounts"}
:web-server
{:port 8192}}
----
Expand Down Expand Up @@ -120,12 +120,12 @@ properties beyond those obtained from docker secrets, environment variables and
----
(require '[clojure.edn :as edn]
'[clojure.java.io :as io]
'[com.walmartlabs.dyn-edn :refer [env-readers])
'[com.walmartlabs.dyn-edn :refer [env-readers]])

(->> "config.edn"
io/resource
slurp
(edn/read-string {:readers (env-readers)})
(edn/read-string {:readers (env-readers)}))
----

=== Usage with Docker secrets
Expand All @@ -147,23 +147,23 @@ $ docker service create --replicas 1 --name <servicename> \

The above will create a secret called `my-secret` and make it available as a file at `/mysecrets/mysecret`.

The following can be used to recover the secret within the Docker conainer:
The following can be used to recover the secret within the Docker container:

[source,clojure]
----
(require '[clojure.edn :as edn]
'[clojure.java.io :as io]
'[com.walmartlabs.dyn-edn :refer [env-readers])
'[com.walmartlabs.dyn-edn :refer [env-readers]])

(->> "config.edn"
io/resource
slurp
(edn/read-string
{:readers (env-readers
{:docker-secrets-dir "/mysecrets"})})
{:docker-secrets-dir "/mysecrets"})}))
----

If the `:docker-secrets-dir` is not available as a property, it's assumed that all secrets have been mounted at
If `:docker-secrets-dir` is not available as a property, it's assumed that all secrets have been mounted at
`/run/secrets` (which is Docker's default location).

NOTE: In order for secrets to be available under this library, it is assumed that all secrets are mounted in the same directory.
Expand All @@ -180,7 +180,7 @@ $ docker service create --replicas 1 --name <servicename> \
----

and if DB_PORT is **not** in the Environment of the container, the outcome will be the same. The value of the parameter
will be read from the file at `/run/secrets/DB_HOST` and made available.
will be read from the file at `/run/secrets/DB_PORT` and made available.

NOTE: the value of an env variable with a particular name will overwrite a secret with
that name i.e. an environment variable has precedence.
Expand Down