I want to set up a "constant" variable in my angular2 application. But, depending if a system variable is set or not.
Now I have this:
export const backendUrl: string = process.env.BACKEND_URL || 'http://localhost:8080';
Basically, I want that, if the System variable BACKEND_URL is set, the constant backendUrl is set to that system variable, but, if not, then it is localhost.
I want that to make the backend url different depending if I am in production or development.
But I am getting the error that the process variable is not defined. How can I do that in typescript? Or, do you have any better idea on how to change the backend url depending if I am in production or development?