Fork me on GitHub
#polylith
<
2024-03-26
>
mafcocinco02:03:22

This might be a silly question, but I don’t see any documentation on how to set environment variables for local development (i.e. workspace?). With Leiningen and Boot, there is environ library which I was hoping to be able to use with Polylith. Maybe I have an incorrect mental model and the approach within polylith projects is different. Is it possible to set environment variables that are accessible from environ within the deps.edn or workspace configuration for use in local development? Is that something that one should even want to do with polylith? If not, how does polylith approach 12 factor application development in the context of developer experience?

Patrix05:03:21

Polylith doesn't prescribe or restrict anything, here. I myself use environment variables (for my deployed projects), in conjunction with integrant and aero which together allow me to specify #env SOME_ENV_NAME in my integrant configs. Seems environ works similarly though it appears more geared to lein and boot, as well as simple env variables. Polylith projects use deps.edn instead, so you'll have to make do with environment variables. Set them then launch your REPL before connecting to it, rather than launching the REPL from cider or calva with the jack-in command.

mafcocinco15:03:52

I was unaware of aero. I like its design better then environ and will be using it. Thank you!

👍 1
Patrix01:03:14

Sure, no prob! Also a small clarification on my setup: I have quite a few system.edn files.. the one in development/resources is the one that is read when I work at the REPL, using functions in development/src/user.clj This one does not make use of env variables (anymore), as this system.edn file is not checked into git anyway. When I first started I would have env vars in there but got annoyed at having to set them up before launching my REPL. The project-specific system.edn files however do make use of env vars, as I explained above.

👍 1