Fork me on GitHub
#reagent
<
2020-04-13
>
Greg Jeanmart12:04:23

Hi there, I was wondering if there is a way to access a custom environment variables like process.env.REACT_APP_API_KEY with reagent? Something similar to this functionality provided by react-script https://create-react-app.dev/docs/adding-custom-environment-variables/

juhoteperi12:04:35

@greg851 Depends on the build tool, not really related to Reagent. With Cljs usually you'd use Closure defines to declare build time constants: https://clojurescript.org/reference/compiler-options#closure-defines and then you can set these from your build tool, maybe from env variables, like Shadow-cljs supports: https://shadow-cljs.github.io/docs/UsersGuide.html#shadow-env

👍 4
Greg Jeanmart13:04:02

good point. I'm using shadow-cljs.