I think your alternative would be to write a Java-action and call the portal-api to retrieve the required data.
But that seems more trouble than it's worth if your alternative is adding a constant. Also: you would probably need constants there as well to indicate which environment you're on.
Why the reluctance for adding a constant?
Are those environment by url not different, so you can check the get application root url in a MF?