boot-environ/environ weird precedence
st opened this issue · 2 comments
In a new project, let's create this task:
(deftask run-tests
[]
(comp
(environ :env {:config-path "path-test.edn"})
(test)))
and add this test
(deftest environ-precendence
(is (= "path-test.edn" (environ/env :config-path))))
It works fine until environment variable CONFIG_PATH
is declared.
$ export CONFIG_PATH=path-prod
...
FAIL in (environ-precendence) (core_test.clj:8)
expected: "path-test.edn"
actual: "path-prod"
diff: - "path-test.edn"
+ "path-prod"
Shouldn't binding in deftask (environ :env {:config-path "path-test.edn"})
have precedence over environment variable?
It should have precedence. The code performs a (merge environ/env env)
, so the environment argument should take precedence. If it's not, something is going weirdly wrong.
Hi,
thanks for quick answer.
Looking at the code, I came to the same conclusion (if merge
is not broken ;-) )
Here is a tiny project to show/reproduce this issue:
https://github.com/st/precedence
(especially https://github.com/st/precedence/blob/master/test/precedence/core_test.clj)
Keep in mind there may be something I misunderstood.