Fork me on GitHub
#leiningen
<
2015-10-26
>
genRaiy10:10:07

hello leins, has anybody tried to access env vars from within the repository definition?

genRaiy10:10:31

like this

:repositories {"" {:url      ""
                                   :username (System/getenv "MY_DATOMIC_USERNAME")
                                   :password (System/getenv "MY_DATOMIC_PASSWORD")}}

genRaiy10:10:55

it gives me an error on Heroku ..

genRaiy10:10:35

remote: -----> Building with Leiningen
remote:        Running: lein uberjar
remote:        java.lang.IllegalArgumentException: No matching ctor found for class org.sonatype.aether.repository.Authentication
remote:         at clojure.lang.Reflector.invokeConstructor (Reflector.java:183)
remote:            cemerick.pomegranate.aether$set_authentication.invoke (aether.clj:164)
remote:            cemerick.pomegranate.aether$make_repository.invoke (aether.clj:185)
remote:            cemerick.pomegranate.aether$resolve_dependencies_STAR_$fn__194.invoke (aether.clj:712)
remote:            clojure.core$map$fn__4553.invoke (core.clj:2622)

genRaiy10:10:08

hangon … maybe some google juice has helped

genRaiy10:10:25

I will check that out and confirm

xeqi10:10:56

though I thought #=(System/getenv "MY_DATOMIC_USERNAME") was sufficent

genRaiy10:10:05

yes, using LEIN_ vars did the job

genRaiy10:10:42

this is how it looks:

:repositories {"" {:url      ""
                                   :username :env
                                   :password :env}}

genRaiy10:10:02

with LEIN_USERNAME and LEIN_PASSWORD

mishok1315:10:20

I seem to be having an issue with leiningen and :global-vars

mishok1315:10:33

the project.clj contains the following:

:profiles {:uberjar {:aot :all
                       :global-vars {*assert* false}}}

mishok1315:10:16

and the core.clj is:

(defn -main
  [& args]
  (println "Assert is:" *assert*))

mishok1315:10:51

however after compiling an uberjar and running it (through java -jar ...) I get Assert is: true

xeqi19:10:38

@mishok13: http://stackoverflow.com/questions/4874517/how-to-make-clojure-respect-assert-variable seems to hint that assert matters for compilation time, not runtime. If you replace the println with an assert does it error?

mishok1319:10:27

@xeqi: you're absolutely right