In my Leiningen project.clj I am using environ to set environment variables in different profiles. I want to build a demo uberjar with lein-ring, which uses different values for certain environment variables to the production version. For some reason I cannot seem to pick them up, however.
I have a demo
profile defined something like this in my project.clj:
:demo {:dependencies [[javax.servlet/servlet-api "2.5"]]
:plugins [[lein-environ "0.4.0"]]
:env {:foo "FOO" :bar "BAR"}}
Then I execute
lein with-profile demo ring uberjar
But accessing foo or bar with environ.core/env
inside the resulting standalone jar returns nil
in both cases. On the other hand if I run
lein with-profile demo ring server-headless
I can access the values of both.
Why is this happening? It's really not what I would have expected. It looks like the uberjar is always being created with the production profile. Or is something else going?
The lein-ring page does state the following:
Lein-Ring pays attention to several environment variables, including: PORT - the port the web server uses for HTTP SSLPORT - the port the web server uses for HTTPS
These will override any options specified in the project.clj file, but won't override any options specified at the command line.
It's not clear that that means that any other environment variables specified in project.clj will be ignored, however.
Running leiningen 2.3.4 on Windows.