简体   繁体   中英

lein test with-profile unable to override test profile's env value

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 with lein with-profile travis,test pprint

Solution: I assume you're using environ or something like that. If so, you can export values with env in UPCASE_WITH_UNDERSCORE (eg DATABASE_NAME=test_library_test ) and they will override values in profiles

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM