Quantcast
Channel: OCaml - Topics tagged dune
Viewing all articles
Browse latest Browse all 521

Where to write `env` stanza in a dune file to modify environment variables

$
0
0

@ruyblast wrote:

Hi !
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 !

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 521

Trending Articles