I need to modify environment variables to compile a project. I work with dune and I saw there and there that one can modify environment variables during dune building process, using env stanza. However, I do not understand where to write env stanza to make it work.
Here is my dune file:
(env (_ (env-vars (DB_HOST localhost) (DB_PORT 3000) (DB_NAME db) (DB_PASSWORD "***") ) ) ) (library (name administrative_book) (libraries type pgocaml pgocaml_ppx ocsigen-start.server) (preprocess (pps ppx_deriving.std pgocaml pgocaml_ppx)) )
When I try
dune build core/administrative_book/administrative_book.a, I get an error message showing me that environment variable was not the ones I defined in dune file.
I tried to put env stanza after or inside library stanza (inside it stated that env stanza was not suited there).
In case, I have no dune-workspace file, and here is my dune-project file:
(lang dune 2.0) (name myproject) (version 1.0)
Do you know where to write env stanza ?
Thank you for your help !