Hi all! I’m using Rails 7 with importmaps and I’m trying to make JavaScript code conditionally depend on the environment specific config. At the very least, I’d need to pass what environment is it in the first place (dev, test, etc) and ideally I’d like to pass arbitrary env dependent configuration.
What I could do is serve a js file from a controller and create a global config var in it, serving whatever config info I want to be available to the js code.
But I’m wondering if I’m missing some obvious “official” way do so. Is there one?