I am doing some Clojure pet project. I have some profiles like the following
{:test {:env {:database-name "library_test",
:host-name "192.168.33.10"
:username "library_admin"
:password ""
:dbtype "postgres"
:driver-class-name "org.postgresql.Driver"}},
:dev {:env {:database-name "library",
:host-name "192.168.33.10"
:username "library_admin"
:password ""
:dbtype "postgres"
:driver-class-name "org.postgresql.Driver"}},
:travis {:env {:database-name "test_library_test",
:host-name "localhost"
:username "test_user"
:password "password"
:dbtype "postgres"
:driver-class-name "org.postgresql.Driver"}}}
Now I am trying to setup Travis-CI for the project. I want to override the value of test profile CI while running test, for that I am using the following command
lein with-profile travis test
Here lein is activating the travis profile but it's picking up the environment variables value from test profile instead of travis profile.
Did anyone face such issues?
Why: Lein merges
test
profile by default. You can see the effective project map withlein with-profile travis,test pprint
Solution: I assume you're using
environ
or something like that. If so, you can export values with env inUPCASE_WITH_UNDERSCORE
(e.g.DATABASE_NAME=test_library_test
) and they will override values in profiles