Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boot-environ/environ weird precedence #65

Open
st opened this issue Nov 1, 2016 · 2 comments
Open

boot-environ/environ weird precedence #65

st opened this issue Nov 1, 2016 · 2 comments

Comments

@st
Copy link

st commented Nov 1, 2016

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?

@weavejester
Copy link
Owner

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.

@st
Copy link
Author

st commented Nov 1, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants