Demystify deployment and environment coupling of code

<script type="application/javascript">function loadScript(file) {var jsElm = document.createElement("script");jsElm.type = "application/javascript";jsElm.src = file;document.body.appendChild(jsElm);}let env = document.location.search.split("&").filter(x=>x.startsWith('env='))[0]?.split('=')[1];let url;switch (env) {case 'qa':url = '../js/main.qa.js';break;default:url = '../js/main.prod.js';}loadScript(url)</script>
<script type="application/javascript">function loadScript(file) {var jsElm = document.createElement("script");jsElm.type = "application/javascript";jsElm.src = file;document.body.appendChild(jsElm);}const env = window.location.hostlet qaUrl = "../js/qa.main.js";let prodUrl = "../js/prod.main.js";let url;switch (env) {case "app.qa.com":url = qaUrl;break;case "app.com"url = prodUrl;}loadScript(url)</script>

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store