var config = { dev: { apiBaseURL: 'http://localhost:8080/hdpos/api' }, prod: { apiBaseURL: 'http://V-XSTO-A01-IIDC.adic.lan/hdpos/api' } }; // Now we check the hostname where the script is running var env = window.location.hostname.includes('localhost') ? 'dev' : 'prod'; var selectedConfig = config[env]; // Make the selected configuration available for other scripts window.config = selectedConfig;