Hi,
1. Have all these configurations in OSGI config Mgr
2. Create a OSGI service to populate these on page load in <head></head> section page in script tag,
3. Now you can directly read these global url from anywhere in page
This is one of the good, easy way to have environment specific URL in JS