Fork me on GitHub
#figwheel-main
<
2022-03-05
>
jumar08:03:52

Is it possible to define :open-url dynamically in figwheel configuration? I have this right now:

:open-url ""
I need the port to be configurable - sort of like [[server-port]] but not quite because the port here is the backend server port which is configured separately - by default, we use 5000, I use 5001, somebody else might use something different. Right now, I can only think of parsing the port number from the config (`profiles.clj`) and dynamically updating figwheel-main.edn before figwheel build is started.

jumar09:03:17

The best thing I was able to come with was renaming my current figwheel-main.edn to figwheel-main.edn.template and create a script that will automatically generate figwheel-main.edn with proper port by reading it first from profiles.clj.

jumar09:03:30

server_port=$(cat profiles.clj | bb '(get-in *input* [:profiles/dev :env :options :port])')
sed "s/\[\[server-port\]\]/${server_port}/" figwheel-main.edn.template > figwheel-main.edn

mikerod21:03:33

Figwheel main has a scripting interface too where you pass the configs as runtime maps instead of using files at all.

mikerod21:03:38

So that's another possible path