figwheel-main

jumar 2022-03-05T08:58:52.296869Z

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.

jumar 2022-03-05T09:36:17.997269Z

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.

jumar 2022-03-05T09:36:30.813859Z

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

2022-03-05T21:09:33.506539Z

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

2022-03-05T21:09:38.926329Z

So that's another possible path