Is it bad practice to store your backend server origin in a global window variable on client-side?

Is it bad practice to store my backend server’s configuration in a global window variable on client-side?
I.e. is it bad if this is exposed? And if so, why?

window.backendConfig = {
backendApiOrigin:'https://bad-idea-context-root.com/api',
environment:'test'}

In order to later be able to perform fetch calls to that environment dependent origin.