I understand Figwheel allows me to specify different builds. (Perhaps another way to think of them is as environments?)
Based on the build/environment, I may require a different behavior in my code. For example, when in dev, I connect to a certain API endpoint, and in prod it's a different endpoint. Ideally, I would like some way (presumably this belongs in project.clj) of specifying environment specific variables, and then access them in my cljs code.
Is there a mechanism to do this?
I'm picturing something like this:
:cljsbuild {
:builds [{:id "dev"
:source-paths ["src"]
:figwheel true
:env-variables {foo "bar"
bar "foo"} ; <--------
:compiler {:main hello-seymore.core
:asset-path "cljs/out"
:output-to "resources/public/cljs/main.js"
:output-dir "resources/public/cljs/out"}
}
{:id "prod"
:env-variables {foo "different value for foo"
bar "different value for bar"}}] ; <--------
; etc
}
And then in my cljs code I would like to access them somehow. If it matters, I am running a Reagent project.
I understand Figwheel allows me to specify different builds. (Perhaps another way to think of them is as environments?)
Based on the build/environment, I may require a different behavior in my code. For example, when in dev, I connect to a certain API endpoint, and in prod it's a different endpoint. Ideally, I would like some way (presumably this belongs in project.clj) of specifying environment specific variables, and then access them in my cljs code.
Is there a mechanism to do this?
I'm picturing something like this:
And then in my cljs code I would like to access them somehow. If it matters, I am running a Reagent project.