Fork me on GitHub
#re-frame
<
2019-12-28
>
Joel Holmes19:12:58

I’m building an application that uses an existing API and would like to make the api endpoint configurable based on the build type. I am looking for an example online but can’t seem to find one. Is this something I use the shadow cljs config merge? Also how do I then access the value from within the page? I’m new to all of this so I apologize if I’m missing something obvious.

p-himik19:12:49

> Is this something I use the shadow cljs config merge? I think so, yes. > Also how do I then access the value from within the page? Can you elaborate? It's unclear what exactly and from where you want to access.

Joel Holmes20:12:15

I’m trying to use two different endpoints for local development and production but currently have the endpoints hard coded. How do I set base url based on dev or pros and how do I access the value within my code?

Joel Holmes20:12:16

Like from a Java/spring background I could set a value in a .properties file and access the variables using @Value annotation.

p-himik20:12:09

The User Guide of shadow-cljs is the source of many answers. :)

Joel Holmes20:12:49

Perfect, thank you so much! I missed this when scanning. I really appreciate the patience and help!

👍 1
Joe01:12:31

heh, I just asked a similar question in #clojurescript. the approach I tried was having environment dependent source paths, so you could have different definitions with the same namespace. couldn't get it working though, but it would be nice since then you're not limited to constant values, but can have functions and macros as well.

p-himik08:12:03

@UC9FL22JD You can certainly do it with a source path, I use it with tools.deps. It should work in lein as well, so there's probably some error in your project.clj. I've ditched lein quite some time ago so unfortunately I cannot help with that.