I'm trying -- and failing -- to use environ 1.2.0 to create environment variables for codox inside project.clj.
I have in profiles.clj
{:dev {:env {:doc-dir "/home/me/some/dir"}}}
So far all good: .line-env
is correctly created and I can pull the value in a repl.
However I cannot get the value inside project.clj
(defproject ....
:codox {:output-path (environ.core/env :doc-dir) })
I get an error from lein codox
:
Syntax error (IllegalArgumentException) compiling at (/tmp/form-init13693313479173922228.clj:1:74).
No implementation of method: :as-file of protocol: #'clojure.java.io/Coercions found for class: clojure.lang.PersistentList
codox works if I remove the call to environ.core.
What am I doing wrong?
I figured out the problem by looking at the source of codox.
When the plugin pulls the map of the project, it reads without interpreting,
so the output path isn't set to the environment value but to the form (environ.core/env :doc-dir)
However, since the goal is to move the codox parameters to a separate file that git can ignore, the right way to do it is simply to put the :codox section, with hardcoded values, inside the dev profile in profiles.clj
. Codox looks into the profiles as well as into the project.