I need help accessing my environment variables. I have :my-variable "value" in dev-config.edn and I'm trying to access it in another place. I required [my-app.config :refer [env]] and trying the following:
(defn my-function []
(def variable (-> env :my-variable))
(println (str "my environment variable: " variable)))
I tried this and several other things... What's the right to do this?
Clojure can read environment variables via Java, so try this:
Environment variables are strings, as far as Java is concerned. Whatever reads "dev-config.edn" converts your
:my-variablekeyword to a string. Perhaps this is it: https://github.com/yogthos/config . It mentions some details of the conversion, including "names lowercased, then_and.characters converted to dashes".